Vs2019 无法运行 NUnit 测试 - “testhost.x86.exe”问题

Ros*_*oss 5 c# windows nunit visual-studio visual-studio-2019

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

但是,当我尝试运行测试时,它似乎启动和停止,甚至不执行任何操作,甚至使用调试运行。测试保持在该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");
}
Run Code Online (Sandbox Code Playgroud)

错误日志

'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).
Run Code Online (Sandbox Code Playgroud)

我已经设置了环境变量

__UNITTESTEXPLORER_VSINSTALLPATH__

指向

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE

正如一些人所建议的。我发现的唯一其他建议是更新 VS17,但是我正在使用 VS19,找不到有关此版本的任何信息。

Ros*_*oss 5

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

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