VS 2017无法看到xunit的代码覆盖率结果

编程入门 行业动态 更新时间:2024-10-12 03:27:20
本文介绍了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:

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的代码覆盖率结果

本文发布于:2023-11-14 22:09:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1588624.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:覆盖率   代码   xunit

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!