为什么 nUnit 测试在 Visual Studio 2015 年经常消失?

Why do nUnit tests frequently disappear in Visual Studio 2015?

我 运行 遇到了一个令人沮丧的 nUnit 3 问题。我相信这个问题也发生在 nUnit 2 上,但现在发生得更频繁了。

在 VS2015 中,编译后我会突然在测试资源管理器中丢失一半的单元测试。干净的构建或 visual studio 重新启动将修复它,但在大型解决方案中这真的很烦人。我还没有确定为什么有些测试继续出现而其他测试消失了 - 项目文件的比较表明它们使用相同的库和项目设置。

我正在使用 nUnit3,并将 nUnit3 测试适配器安装为扩展以及 nuget 包(仅尝试过 nuget 包,测试未显示)

此特定问题已在适配器版本 3.0.9 中修复。查看问题 126 and 131

案例,来自 Charlie Poole:

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.