Resharper not running new unit tests

允我心安 提交于 2019-12-12 08:17:35

问题


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


回答1:


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




回答2:


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




回答3:


Unit Test Methods must be public. The following test will not be recognized.

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

Whereas this test is recognized:

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



回答4:


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.




回答5:


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.




回答6:


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)




回答7:


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




回答8:


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.




回答9:


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.




回答10:


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.



来源:https://stackoverflow.com/questions/6066149/resharper-not-running-new-unit-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!