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

8 comments

If I use mstest.exe, the test passes, but using the ReSharper testrunner, they don't.

0

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.

0

The tests didn't run in 6.0 either.  I did try the mstest option you reference, but it gave me an error when I tried it.

0

I found this posting on Microsoft's connect website:

http://connect.microsoft.com/VisualStudio/feedback/details/483939/unable-to-change-target-framework-version-on-unit-test-projects

I tried the suggested workaround of removing the ProjectTypeGuid and that worked.  When I open the project again, it keeps the UnitTestFramework version of 10.0 and doesn't try replacing it with 10.1.

Why does 10.0 work but not 10.1?  Very strange.

Thanks,
Jason

0

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

0

Hi, J F

did you try workaround found by Jason Reis?

0

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.

0

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.
0

Please sign in to leave a comment.