简体   繁体   中英

ReSharper not running new unit tests

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

它还帮助我公开单元测试类:D

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

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;
}

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.

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)

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

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.

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM