Visual Studio 测试资源管理器中未发现 Nunit 3.2.1 测试

Nunit 3.2.1 Tests not discovered on Visual Studio Test explorer

这是我的配置:

  1. Visual Studio 企业 2015
  2. NUnit 3.2.1
  3. NUnit3 测试适配器 3.0.10(作为扩展和更新以及通过项目中的 nuget 包管理器安装)
  4. 目标框架设置为 4.5

构建成功,但测试发现显示错误,发现 0 个测试。

错误日志:

Exception NUnit.Engine.NUnitEngineException, Exception thrown discovering tests in C:\projects\~
The NUnit 3.0 driver does not support the portable version of NUnit.
Use a platform specific runner.
NUnit Adapter 3.0.10.0: Test discovery complete.
Discover test finished: 0 found

当运行使用 NUnit 3 适配器(正确名称)版本 3.0.10 时,您正在使用 NUnit 3.0.1 来 运行 您的测试.如果测试使用 3.2.1 框架,则存在不兼容的可能性。 NUnit 运行ners 总是向后兼容的。例如,您可以使用 NUnit 3.2 来 运行 NUnit 3.0 测试,但反之则不然。

您看到的消息实际上具有误导性,最近在代码中进行了更改。当发生序列化异常时,它假定您正在 运行 进行可移植测试。