我有一个带有单独测试项目的网络应用程序,使用 NUnit 来运行单元测试。当我的测试项目尝试发现测试时,我遇到了以下异常:
An exception occurred while test discoverer 'NUnit3TestDiscoverer' was loading tests. Exception: Could not load file or assembly 'nunit.engine, Version=3.7.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The system cannot find the file specified.
这当然是一个非常常见的错误,但我无法在任何地方找到对此特定程序集的引用,也找不到实际上导致问题的其他依赖项。另一件事是我目前有3.9.0
安装了 NUnit 而不是提到的3.7.0
。
我已经尝试清理和重建解决方案并恢复所有 Nuget 包并清除obj
目录也没有帮助。
在最新版本的 Visual Studio 中,这种情况经常发生。我们不确定原因,但原因是 Visual Studio 缓存中测试适配器的副本不完整。修复方法是删除缓存的副本并重新启动 Visual Studio。
您要删除的文件夹是C:\Users\username\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnit3TestAdapter.3.x.x
取决于您的用户名和版本。
See https://github.com/nunit/nunit3-vs-adapter/issues/261 https://github.com/nunit/nunit3-vs-adapter/issues/261 and http://hermit.no/how-to-resolve-cases-of-visual-studio-no-tests-appearing/ http://hermit.no/how-to-resolve-cases-of-visual-studio-no-tests-appearing/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)