VS 2017无法看到xunit的代码覆盖率结果 [英] VS 2017 unable to see code coverage results with xunit

查看:679
本文介绍了VS 2017无法看到xunit的代码覆盖率结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 

我在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:

https://developercommunity.visualstudio.com/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 seems not be fixed yet.

解决方法是使用名为 Opencover,的工具,因此您需要参考

此博客
来制作它。

A workaround is to use a tool called Opencover, so you refer this blog to make it.

希望它有帮助。 

Hope it helps. 

祝你好运,

Fletch

 


这篇关于VS 2017无法看到xunit的代码覆盖率结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆