27
votes

When I create new NUnit unit tests in my test project, the ReSharper Unit Test Runner detects them but they remain grey and are not run.

This behaviour occurs whether I try to run the tests individually or all together.

If I close and reopen the solution, the new tests are detected and run correctly.

The behaviour only occurs if I build the solution using Visual Studio before I run the tests. If I let ReSharper trigger the build, the tests are detected correctly.

I am using:

  • Visual Studio 2010
  • ReSharper
  • NUnit 2.5.7
10
I'm now using ReSharper 6.1 and the issue has gone away.aboy021

10 Answers

25
votes

It also helped me to make the unit test class public :D

25
votes

Try cleaning the solution and delete RS related files and folders from your project folder. It has worked for me. I use VS2008 though.

4
votes

Unit test methods must be public.

This test will not be recognized:

[Test]
void RunTest(){
    Assert.True;
}

Whereas this test is recognized:

[Test]
public void RunTest(){
    Assert.True;
}
1
votes

Ran into this while using specflow. New project > nuget specflow then I added spec (nunit) tests. Then I received the error. Merely restarting my only running visual studio 2012 instance fixed the issue.

0
votes

I've seen this issue. In my specific case, it was due to building my code to a network drive lacking Full Trust.

Although VS is happy to build and run from there - NUnit was not happy. Unhelpfully it doesn't display any reason for the failure (just those unexplained grey dots by the test names)

0
votes

Just ran into this today using VS 12, NUnit and RS 8.2. There is a setting on the Unit Test Session console for Build Settings. Make sure it is set to Automatic NOT Automatic (Whole Solution).

0
votes

I ran into the same issue. I am running VS2013 with ReSharper 8.2.3. Cleaning and rebuilding the solution did not resolve the error.

My test method was async but returned void. Returning a Task fixed the error.

0
votes

Also make sure you actually have the [Test] annotation or [TestCase(...)] annotation on your method. If that is not there, then you definitely won't see the test in the list.

0
votes

I got a similar issue fixed installing the NuGet NUNitTestAdapter.

I am using NUnit v.2.6.4 and the NUnitTestAdapter v2.1.1 did the trick.

0
votes

Deleting the _ReSharper folder and the ReSharper CACHE file did not fix the issue for me.

I had this issue today where ReSharper would not run the unit tests, and I fixed the problem by running Clean Solution and then rebuilding the solution.