简体   繁体   English

ReSharper不再运行单元测试

[英]ReSharper no longer runs unit tests

I'm trying to write some unit tests for an app I work on at work (In the vague hope that others might follow suit), and I was originally running these tests using NUnit and the ReSharper plugin. 我正在尝试为我在工作中工作的应用程序编写一些单元测试(模糊地希望其他人可能会效仿),而我最初使用NUnit和ReSharper插件运行这些测试。

However, ReSharper will no longer run tests for me for some reason: It simply crosses them out with a red strikeout. 但是,由于某些原因,ReSharper将不再为我进行测试:它只是用红色三振出来进行测试。

There's no error code I'm afraid, and there's no mention of such behaviour on the JetBrains site. 我担心没有错误代码,JetBrains网站上也没有提到这种行为。

Has anyone else experienced similar benhaviour? 还有其他人经历过类似的行为吗?

Cheers, Ed 干杯,艾德

EDIT 编辑

An example of a test, just to show that I'm not just doing them wrong: 一个测试的例子,只是为了表明我不只是做错了:

using NUnit.Framework;

/// <summary>
/// Test
/// </summary>
[TestFixture]
public class Test
{
    [Test]
    public void TestOne()
    {
        Assert.IsTrue(true);
    }
}

Not exactly much to go wrong in that example :D 在这个例子中出错并不是很多:D

Most probably you incidentally deleted [TestFixture], [Test] attributes, made the test methods private, or the test class private. 很可能你偶然删除了[TestFixture],[Test]属性,使测试方法成为私有,或者测试类是私有的。

Please post some example code if the above is not the case (whole class including class declaration) 如果不是这种情况,请发布一些示例代码(全班包括类声明)

I had a similar issue recently. 我最近遇到过类似的问题。 The cause was that some config files which some of the tests required were not being copied to the relevant bin directory. 原因是某些配置文件需要将某些测试文件复制到相关的bin目录中。 The "copy if new/copy always" property on the file had got reset at some point. 文件上的“copy if new new / copy always”属性已在某个时刻重置。 I got the same lack of feedback that you are seeing, and couldn't work out the problem until i upgraded resharper from 4.5 to 5. Then it started giving me an error message about one of the files. 我得到了同样缺乏你所看到的反馈,并且在我将resharper从4.5升级到5之前无法解决问题。然后它开始给我一个关于其中一个文件的错误消息。

Since you're already using v5, this probably won't help you that much! 由于你已经在使用v5,这可能对你没有多大帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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