NUnit3TestExecutor 使用当前发现模式发现了 0 个 NUnit 测试用例,显式 运行

NUnit3TestExecutor discovered 0 of 1 NUnit test cases using Current Discovery mode, Explicit run

当我从测试资源管理器 运行 我的 SpecFlow+NUnit 测试时,所有测试总是 运行,即使我只选择了一些测试。

我也看到了这条消息,我怀疑它是相关的:

NUnit3TestExecutor discovered 0 of 1 NUnit test cases using Current Discovery mode, Explicit run

此外,在测试运行之后,即使成功了,它们仍然被标记为“不运行”。

我该如何解决这个问题?

我按照 https://github.com/nunit/nunit-vs-adapter/issues/125 中的建议,通过将解决方案中的所有 nuget 包升级到最新版本来修复它。我不知道为什么修复它,但确实如此。

升级 nuget 包后出现错误:

System.IO.FileLoadException : Could not load file or assembly 'nunit.framework, Version=3.13.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

已按照 https://github.com/SpecFlowOSS/SpecFlow/issues/2387 中的建议解决此问题: