我在 nUnit 3 上遇到了一个令人沮丧的问题。我相信 nUnit 2 也发生了这个问题,但现在发生的频率更高。
在 VS2015 中,编译后我会突然在测试资源管理器中丢失一半的单元测试。干净的构建或重新启动视觉工作室将修复它,但这在大型解决方案中真的很烦人。我还没有确定为什么一些测试继续出现而其他测试消失 - 项目文件的比较表明它们使用相同的库和项目设置。
我将 nUnit3 与作为扩展安装的 nUnit3 测试适配器以及 nuget 包一起使用(仅尝试了 nuget 包,测试未显示)
最佳答案
此特定问题已在适配器版本 3.0.9 中修复。查看问题 126和 131 .
案例,来自查理普尔:
I discovered that we were getting a COM exception from VS when calling RecordEnd on Explicit Tests for which no RecordStart was called. This does not seem to actually cause a problem for earlier VS products but appears to do so for VS2015. I'm catching the exception and displaying a message. This seems to eliminate the intermittent failures of VS2015 to complete the execution of tests but I'm not certain the problem won't pop up again.
In any case, it still seems like a good idea that we don't propogate exceptions back to NUnit from the listener.
关于unit-testing - 为什么 nUnit 测试经常在 Visual Studio 2015 中消失?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35589927/