gpt4 book ai didi

c# - Vs2019 无法运行 NUnit 测试 - 'testhost.x86.exe' 问题

转载 作者:行者123 更新时间:2023-12-03 11:06:02 26 4
gpt4 key购买 nike

我使用 NUnit 创建了一个 selenium 测试框架,有一个测试来打开页面并断言页面标题。

但是,当我尝试运行测试时,它似乎开始和停止,甚至在使用 Debug 运行时也不做任何事情。测试保留在 not run状态。

当我在 { 上设置断点时并使用调试运行测试,没有任何变化。它在不运行测试的情况下启动并立即停止。

测试:

[Test]
[TestCase(Browser.Chrome)]
public void ValidateWebDriverLaunches(Browser browser)
{
Driver = StaticWebDriverFactory.GetLocalWebDriver(browser);
Driver.Url = "https://example.com/";

string title = Driver.Title;
Assert.AreEqual(true, title.Contains("Example Domain"), "Title is not matching");
}

错误日志
'testhost.x86.exe' (CLR v4.0.30319: Domain 2): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
'testhost.x86.exe' (CLR v4.0.30319: Dependency finder domain): Unloaded 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\TestPlatform\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll'
The thread 0xcc has exited with code 0 (0x0).
'testhost.x86.exe' (CLR v4.0.30319: Domain 3): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
'testhost.x86.exe' (CLR v4.0.30319: Dependency finder domain): Unloaded 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\TestPlatform\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll'
The thread 0x2f90 has exited with code 0 (0x0).
The thread 0x2f80 has exited with code 0 (0x0).
The program '[8948] testhost.x86.exe' has exited with code 0 (0x0).

我已经设置了环境变量
__UNITTESTEXPLORER_VSINSTALLPATH__
指向
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE
正如一些人所建议的那样。我发现的唯一其他建议是更新 VS17,但是我使用的是 VS19 并且找不到有关此版本的任何信息。

最佳答案

我发现问题出在我自己身上。

我安装了 NUnit3TestAdapter nuget 包,它现在按预期工作。

关于c# - Vs2019 无法运行 NUnit 测试 - 'testhost.x86.exe' 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58080236/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com