NUnit无法构建测试 - 未发现任何测试

时间:2016-06-08 03:44:20

标签: c# selenium nunit

我正在研究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,但问题未解决。

请帮我解决此问题。

谢谢。

4 个答案:

答案 0 :(得分:6)

我今天遇到这个问题有些奇怪的原因,因为我在此期间没有改变任何东西而且之前有效。

修正了:项目 - > [YourProjectName] .properties - >构建 - >平台目标:"任何CPU" - > Untick"首选32位"

答案 1 :(得分:1)

这似乎是同样的问题:Visual Studio FsUnit test setup - Exception NUnit.Engine.NUnitEngineException所以安装适配器版本3.0.10应该可以解决您的问题。至少它对我有用。

您可以在github上关注此问题。

答案 2 :(得分:1)

我遇到了与NUnit 3测试适配器(版本3.2.0)相同的问题。我卸载它并尝试了NUnit Test Adapter Version 2.0.0.0。这解决了我的问题。

我使用VS>工具>安装/卸载适配器的扩展和更新。

我的VS项目已设置为针对Platform x86构建,我使用的是VS Ultimate 2013 Update 5.

答案 3 :(得分:1)

我的.NET Core 2.0项目在NUnit 3.9中遇到Visual Studio 2017时遇到了同样的问题,并且已经坚持了很长时间。其他相关问题中提出的解决方案均无效。

然后我从 this 链接中发现,目标.NET Standard的类库不起作用。测试项目必须以.NET Core为目标。此外,还需要Microsoft.NET.Test.Sdk NuGet。

所以,步骤是

  1. 确保测试项目的目标是.NET Core
  2. 安装最新的NUnit NuGet(我使用3.9)
  3. 安装相应的NUnitAdapter NuGet(我使用的是NUnit3Adapter)
  4. 安装Microsoft.NET.Test.Sdk NuGet
  5. 重新构建,您的测试将显示在Visual Studio中的测试资源管理器中。

相关问题