unit-testing - 为什么 nUnit 测试经常在 Visual Studio 2015 中消失?

标签 unit-testing visual-studio-2015 nunit nunit-3.0

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

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

我将 nUnit3 与作为扩展安装的 nUnit3 测试适配器以及 nuget 包一起使用(仅尝试了 nuget 包,测试未显示)

最佳答案

此特定问题已在适配器版本 3.0.9 中修复。查看问题 126131 .

案例,来自查理普尔:

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/

相关文章:

unit-testing - 单元测试中的 "bad"属性是什么?

vb.net - 罗斯林错误?在非共享成员上,我收到错误,我正在使用 'shared member initializer'

c++ - CGAL 错误 : Eigen3 is required -> Eigen seems to be okay though

c# - 使用 nunit 控制台传递测试用例参数

c# - Nunit Selenium 具有值的并行测试

javascript - 使用 javascript/coffeescript 的依赖注入(inject)以帮助可测试性

asp.net - 单元测试未通过,因为没有看到 api Controller 的任何返回

perl - 模拟 Perl 的 Test::More::done_testing 最惯用的方法是什么?

c# - AutoMapper CS 文件在 Visual Studio 2015 中速度极慢

c# - Asp.net Identity 在没有 HttpContext 的情况下创建用户