繁体   English   中英

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

[英]NUnit fail to build test - No Tests discovered

我正在研究selenium web driver项目。 我能够在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 ,但问题未解决。

请帮我解决这个问题。

谢谢。

我出现这个问题只是因为一些奇怪的原因,因为在此期间我没有改变任何东西而且之前有效。

修复它:Project-> [YourProjectName] .properties - > Build - > Platform target:“Any CPU” - > Untick“Prefer 32-Bit”

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

你可以在github上关注这个问题。

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

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

我的VS项目设置为Platform x86构建,我正在使用VS Ultimate 2013 Update 5。

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

然后我从这个链接中发现,目标.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

重新构建,您的测试将出现在Visual Studio中的测试资源管理器中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM