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

问题描述 投票:4回答:4

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

请帮我解决这个问题。

谢谢。

c# selenium nunit
4个回答
1
投票

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

您可以关注github上的问题。


6
投票

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

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


1
投票

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

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

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


1
投票

我在.NET Core 2.0NUnit 3.9Visual 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

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

© www.soinside.com 2019 - 2024. All rights reserved.