NUnit 无法构建测试 - 未发现测试
NUnit fail to build test - No Tests discovered
我正在研究 selenium
网络驱动程序项目。我能够在 Test Explorer
中构建测试并执行。
我在重建解决方案时立即遇到以下错误。
Unit Adapter 3.2.0.0: Test discovery starting
NUnit VS Adapter 2.0.0.0 discovering tests is started
NUnit Adapter 3.2.0.0: Test discovery starting
NUnit VS Adapter 2.0.0.0 discovering tests is started
Attempt to load assembly with unsupported test framework in C:\..\CustomerTest.exe
NUnit VS Adapter 2.0.0.0 discovering test is finished
Attempt to load assembly with unsupported test framework in C:\..\LoginTest.exe
NUnit VS Adapter 2.0.0.0 discovering test is finished
Exception NUnit.Engine.NUnitEngineException, Exception thrown discovering tests in C:\..\CustomerTest.exe
Cannot run tests in process - a 32 bit process is required.
NUnit Adapter 3.2.0.0: Test discovery complete
Exception NUnit.Engine.NUnitEngineException, Exception thrown discovering tests in C:\..\LoginTest.exe
Cannot run tests in process - a 32 bit process is required.
NUnit Adapter 3.2.0.0: Test discovery complete
========== Discover test finished: 0 found (0:00:02.5558095) ==========
我已将默认处理器架构更改为 X64
,但问题未解决。
请帮我解决这个问题。
谢谢。
这似乎是同一个问题: 所以安装 Adapter Version 3.0.10 应该可以解决你的问题。至少它对我有用。
您可以关注 github 上的问题。
我在使用 NUnit 3 测试适配器(版本 3.2.0)时遇到了同样的问题。我卸载了它并尝试了 NUnit 测试适配器版本 2.0.0.0。这解决了我的问题。
我使用 VS > 工具 > 扩展和更新 install/uninstall 适配器。
我的 VS 项目设置为针对平台 x86 构建,我使用的是 VS Ultimate 2013 Update 5。
出于某种奇怪的原因,我今天才遇到这个问题,因为在此期间我没有进行任何更改,而且它以前有效。
通过以下方式修复:项目-> [YourProjectName].properties -> 构建 -> 平台目标:"Any CPU" -> 取消勾选 "Prefer 32-Bit"
我的 .NET Core 2.0
项目在 Visual Studio 2017
中的 NUnit 3.9
也遇到了同样的问题,并为此困扰了很长一段时间。 None 在其他相关问题中建议的解决方案有效。
然后我从 this link 中发现目标 .NET Standard
的 class 库不起作用。测试项目必须针对 .NET Core
。此外,Microsoft.NET.Test.Sdk
需要 NuGet。
所以,步骤是
- 确保测试项目面向
.NET Core
- 安装最新的
NUnit
NuGet(我用的是 3.9)
- 安装对应的
NUnitAdapter
NuGet(我用的是NUnit3Adapter)
- 安装
Microsoft.NET.Test.Sdk
NuGet
重新构建,您的测试将出现在 Test Explorer 中 Visual Studio。
我正在研究 selenium
网络驱动程序项目。我能够在 Test Explorer
中构建测试并执行。
我在重建解决方案时立即遇到以下错误。
Unit Adapter 3.2.0.0: Test discovery starting
NUnit VS Adapter 2.0.0.0 discovering tests is started
NUnit Adapter 3.2.0.0: Test discovery starting
NUnit VS Adapter 2.0.0.0 discovering tests is started
Attempt to load assembly with unsupported test framework in C:\..\CustomerTest.exe
NUnit VS Adapter 2.0.0.0 discovering test is finished
Attempt to load assembly with unsupported test framework in C:\..\LoginTest.exe
NUnit VS Adapter 2.0.0.0 discovering test is finished
Exception NUnit.Engine.NUnitEngineException, Exception thrown discovering tests in C:\..\CustomerTest.exe
Cannot run tests in process - a 32 bit process is required.
NUnit Adapter 3.2.0.0: Test discovery complete
Exception NUnit.Engine.NUnitEngineException, Exception thrown discovering tests in C:\..\LoginTest.exe
Cannot run tests in process - a 32 bit process is required.
NUnit Adapter 3.2.0.0: Test discovery complete
========== Discover test finished: 0 found (0:00:02.5558095) ==========
我已将默认处理器架构更改为 X64
,但问题未解决。
请帮我解决这个问题。
谢谢。
这似乎是同一个问题:
您可以关注 github 上的问题。
我在使用 NUnit 3 测试适配器(版本 3.2.0)时遇到了同样的问题。我卸载了它并尝试了 NUnit 测试适配器版本 2.0.0.0。这解决了我的问题。
我使用 VS > 工具 > 扩展和更新 install/uninstall 适配器。
我的 VS 项目设置为针对平台 x86 构建,我使用的是 VS Ultimate 2013 Update 5。
出于某种奇怪的原因,我今天才遇到这个问题,因为在此期间我没有进行任何更改,而且它以前有效。
通过以下方式修复:项目-> [YourProjectName].properties -> 构建 -> 平台目标:"Any CPU" -> 取消勾选 "Prefer 32-Bit"
我的 .NET Core 2.0
项目在 Visual Studio 2017
中的 NUnit 3.9
也遇到了同样的问题,并为此困扰了很长一段时间。 None 在其他相关问题中建议的解决方案有效。
然后我从 this link 中发现目标 .NET Standard
的 class 库不起作用。测试项目必须针对 .NET Core
。此外,Microsoft.NET.Test.Sdk
需要 NuGet。
所以,步骤是
- 确保测试项目面向
.NET Core
- 安装最新的
NUnit
NuGet(我用的是 3.9) - 安装对应的
NUnitAdapter
NuGet(我用的是NUnit3Adapter) - 安装
Microsoft.NET.Test.Sdk
NuGet
重新构建,您的测试将出现在 Test Explorer 中 Visual Studio。