我在ASP.NET核心web api项目上使用VS 2017使用xunit来编写单元试验。我检查了程序集的每个文件夹,它们都有pdb文件。但是,当我点击测试>分析代码覆盖率>全部或选定的测试,然后我得到测试的输出窗口,显示它们被发现和运行。它们全部通过并显示在Test explorer中。但是我没有看到代码覆盖窗口。在nunit上运行的另一个不是ASP.NET Core的项目,它是一个WPF应用程序。我可以在单独的窗口中查看结果。
I am using VS 2017 on ASP.NET core web api project using xunit to write unit tests. I checked each folder of the assembly and they all have pdb files. However when I hit Test>Analyze Code Coverage > All or Selected Tests , then I get the output window of the Test which shows them being discovered and run. They all pass and are shown in the Test explorer .But I don't see the code coverage window. On another project running on nunit which is not ASP.NET Core , It is a WPF App. I am able to view the results in the separate window.
推荐答案
朋友,
我和你之前的问题完全相同。
I got the exactly same issue as yours before.
.NET Core项目尚不支持代码覆盖率。这是目前的限制。
Code Coverage is not yet supported on .NET Core projects. This is presently a limitation.
我已经在这里提交了一份报告:
I've already submitted a report here:
developercommunity.visualstudio/content/problem /21341/not-able-to-get-code-coverage-result-of-netcoreapp.html?childToView=22471#comment-22471
Visual Studio开发团队已经回复了评论。
And Visual Studio developing team has responded it at with a comment.
到目前为止似乎还没有修复。
So far it seemsnotbefixed yet.
解决方法是使用名为 Opencover,的工具,因此您需要参考 此博客来制作它。
A workaround is to use a tool called Opencover,soyourefer this blog to makeit.
希望它有帮助。
Hopeit helps.
祝你好运,
Fletch
更多推荐
VS 2017无法看到xunit的代码覆盖率结果
发布评论