Resharper没有运行新的单元测试

时间:2021-01-27 15:43:14

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.

当我在我的测试项目中创建新的NUnit单元测试时,ReSharper单元测试运行器会检测到它们,但它们仍然是灰色的并且不会运行。

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.

只有在我运行测试之前使用visual studio构建解决方案时才会出现这种情况。如果我让resharper触发构建,则会正确检测到测试。

I am using: Visual Studio 2010 ReSharper NUnit 2.5.7

我正在使用:Visual Studio 2010 ReSharper NUnit 2.5.7

9 个解决方案

#1


23  

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

尝试清理解决方案并从项目文件夹中删除RS相关文件和文件夹。它对我有用。我虽然使用VS2008

#2


25  

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

它还帮助我公开了单元测试课程:D

#3


4  

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


1  

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.

使用specflow进入此阶段。新项目> nuget specflow然后我添加了spec(nunit)测试。然后我收到了错误。仅仅重新启动我唯一运行的Visual Studio 2012实例就解决了这个问题。

#5


0  

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

删除_ReSharper文件夹和Resharper CACHE文件并没有解决我的问题。

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.

今天我遇到了这个问题,Resharper不会运行单元测试,我通过运行'Clean Solution然后重建解决方案来解决问题。

#6


0  

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)

虽然VS很乐意从那里建立和运行--NUnit并不高兴。无益的是它没有显示任何失败的原因(只是测试名称中那些无法解释的灰点)

#7


0  

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

今天刚刚使用VS 12,NUnit和RS 8.2遇到了这个问题。单元测试会话控制台上有一个用于构建设置的设置。确保将其设置为Automatic NOT Automatic(整体解决方案)。

#8


0  

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.

我遇到了同样的问题。我正在使用ReSharper 8.2.3运行VS2013。清理和重建解决方案无法解决错误。

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

我的测试方法是异步但返回无效。返回任务修复了错误。

#9


0  

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.

还要确保您的方法实际上有[Test]注释或[TestCase(...)]注释。如果那不存在,那么你肯定不会在列表中看到测试。

#1


23  

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

尝试清理解决方案并从项目文件夹中删除RS相关文件和文件夹。它对我有用。我虽然使用VS2008

#2


25  

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

它还帮助我公开了单元测试课程:D

#3


4  

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


1  

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.

使用specflow进入此阶段。新项目> nuget specflow然后我添加了spec(nunit)测试。然后我收到了错误。仅仅重新启动我唯一运行的Visual Studio 2012实例就解决了这个问题。

#5


0  

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

删除_ReSharper文件夹和Resharper CACHE文件并没有解决我的问题。

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.

今天我遇到了这个问题,Resharper不会运行单元测试,我通过运行'Clean Solution然后重建解决方案来解决问题。

#6


0  

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)

虽然VS很乐意从那里建立和运行--NUnit并不高兴。无益的是它没有显示任何失败的原因(只是测试名称中那些无法解释的灰点)

#7


0  

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

今天刚刚使用VS 12,NUnit和RS 8.2遇到了这个问题。单元测试会话控制台上有一个用于构建设置的设置。确保将其设置为Automatic NOT Automatic(整体解决方案)。

#8


0  

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.

我遇到了同样的问题。我正在使用ReSharper 8.2.3运行VS2013。清理和重建解决方案无法解决错误。

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

我的测试方法是异步但返回无效。返回任务修复了错误。

#9


0  

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.

还要确保您的方法实际上有[Test]注释或[TestCase(...)]注释。如果那不存在,那么你肯定不会在列表中看到测试。