我根据文档添加了测试适配器和框架包 https://docs.microsoft.com/en-us/visualstudio/test/live-unit-testing-faq?view=vs-2017 .
我在每个测试旁边看到“烧杯”符号\图标,但悬停表示它已从实时单元测试中排除。
手动测试都运行良好,我尝试右键单击并告诉它包括在内,但什么也没做。我在这里没有手动排除任何代码......
.net 4.7.1 项目
编辑
有错误
[10:03:48.205 Error] [TestRunner 1] An exception occurred while invoking executor 'executor://mstestadapter/v2': Could not load file or assembly 'System.Xml.ReaderWriter, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Could not load file or assembly 'System.Xml.ReaderWriter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
这是一个 4.7.1 项目,用于测试另一个基于 EFCore 的 4.7.1 项目。
最佳答案
我遇到了类似的错误,在“实时单元测试”类别的输出窗口中,我发现了以下错误:
FatalError - System.AggregateException: One or more errors occurred. ---> System.Exception: Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
我下载了那个 nuget 包的最新版本,但没有帮助,我基本上不得不在配置文件中强制使用 4.0.0.0 版本,这没有多大意义,因为 dll 的实际版本是 4.1。 2.0.无论如何,在那之后我停止并开始了 Live Unit Testing,现在它可以正常工作了。希望这可以帮助。
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.0.0.0" />
关于visual-studio - 项目中的每个测试都说 "Excluded from Live Unit Testing"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52005404/