This Question is Possibly Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
8 Replies Last post: Jul 31, 2012 8:47 PM by Ahmad Ibrahim  
Jason Reis Newbie 6 posts since
Aug 4, 2005
Currently Being Moderated

Dec 28, 2011 1:00 AM

Unit tests fail using ReSharper 6.1

Using Visual Studio 2010 SP1 and ReSharper 6.1, we're having trouble with some of our unit tests.  If the test class has a [ClassInitialize] attribute on it, we get this error:

 

Method ClassInit has wrong signature.  Parameter 1 should be of type Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.

 

Secondly, if the test uses [ExpectedException], ReSharper fails the test.

 

Are there any solutions to these issues?  Any suggestions are appreciated.

 

Thanks,

Jason

Victor Kropp JetBrains 154 posts since
May 6, 2009
Currently Being Moderated
Dec 28, 2011 7:48 PM in response to: Jason Reis
Re: Unit tests fail using ReSharper 6.1

Hi Jason,

 

did this tests worked in 6.0?

Have you tried newly introduced option to run tests with mstest.exe as backend? Take a look on MSTest options page.

Ahmad Ibrahim Newbie 1 posts since
Jul 31, 2012
Currently Being Moderated
Jul 31, 2012 8:47 PM in response to: Jason Reis
Re: Unit tests fail using ReSharper 6.1

This blog posting was very helpful in understanding how to get my unit tests to work within mstest, but I still don't know how to get them to work with Refactor.  I'm currently getting the following error when I try to run any of my tests

Method FMSTest.ActiveDirectory.ActiveDirectoryServiceTest.MyClassInitialize has wrong signature.  Parameter 1 should be of type Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.
J F Newbie 3 posts since
Jan 10, 2012
Currently Being Moderated
Jan 10, 2012 7:46 PM in response to: Victor Kropp
Re: Unit tests fail using ReSharper 6.1

I am also experiencing the problems outlined in the original post running R# 6.1 on VS2010SP1.  To give some background we recently upgraded to VS2010 SP1 from VS2008 SP1 but we are not yet ready for .NET 4.0 so we retargeted all projects to .NET 3.5.

 

All of the tests successfully execute and pass when using the Microsoft test runner. If I select the "Run tests with MSTest.exe (not recommended)" R# setting when I run all tests the R# test runner appears with all of the loaded test names but they all stay as "Pending" and never execute.

 

The work arounds are fairly destructive, VS2010 SP1 supports retargeting unit test projects, but there appears to be some issues with R# 6.x.

 

Any other insight on this?

 

Thanks

Victor Kropp JetBrains 154 posts since
May 6, 2009
Currently Being Moderated
Jan 10, 2012 7:51 PM in response to: J F
Re: Unit tests fail using ReSharper 6.1

Hi, J F

 

did you try workaround found by Jason Reis?

J F Newbie 3 posts since
Jan 10, 2012
Currently Being Moderated
Jan 10, 2012 7:55 PM in response to: Victor Kropp
Re: Unit tests fail using ReSharper 6.1

I am not really keen on performing some arbitraty hacks to our solutions and referencing strange version of assemblies that may or may not be appropriate in our context.  We have a rather large codebase and manually hacking at the project files and references for the sake of the R# test runner is not something we are comfortable with.  We are willing to make due with the microsoft test runner for the time being if we could be assured that this was indeed a R# issue and that it would be addressed in a future release?

 

Thanks for your feedback.

More Like This

  • Retrieving data ...