.Net Core 2.0 中的代码覆盖率 [英] Code Coverage in .Net Core 2.0

查看:43
本文介绍了.Net Core 2.0 中的代码覆盖率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 .Net Core 2.0 中生成代码覆盖率?

How can I generate code coverage in .Net Core 2.0?

我尝试了以下方法:

"TestPlatformvstest.console.exe" --collect:"Code Coverage"

但我收到此错误消息:

Data collector 'Code Coverage' message: Cannot find CodeCoverage.exe.

我尝试了 dotCover 最新版本 2017.2,我能够在本地机器上获得覆盖率,但是在 TFS Build 中运行相同的版本时,不会生成覆盖率信息.

I tried dotCover latest version 2017.2 which I am able to get the coverage on the local machine, but when the same is run in the TFS Build no coverage information is generated.

我不确定 TFS 中的 NetCore 测试任务何时会获得对代码覆盖率的支持.

I am not sure when NetCore Test task in TFS will get support for code coverage.

如何在 TFS 中发布 DotCover 的结果,以使用 DotCover 命令行为 .Net Core 生成 Coverage?

How can I publish the results from DotCover in TFS also, to use DotCover Commandline to generate the Coverage for .Net Core?

推荐答案

VSTest 任务无法运行 .NET 核心测试,因为它使用测试平台版本 1.要运行 .NET 核心测试,我们建议将 .NET 核心任务(预览版) 与测试命令一起使用.

VSTest task cannot run .NET core tests as it uses the Test platform version 1. To run .NET core tests, we recommend using the .NET core task(preview) with the test command.

但是,代码覆盖率和其他数据收集不支持,没有代理支持.

However, Code coverage and other data collection is not supported yet, no agent support.

我们正在修复这个问题https://github.com/Microsoft/vsts-agent/pull/1149/文件会更新修复后的线程消失并释放新代理.线https://github.com/microsoft/vstest/issues/579#issuecomment-324401462

We are fixing this issue as part of this https://github.com/Microsoft/vsts-agent/pull/1149/files Will update the thread once fix is gone and new agent is released. thread https://github.com/microsoft/vstest/issues/579#issuecomment-324401462

源链接:VSTest 任务无法在 .NET Core 2.0 中执行测试测试项目

这篇关于.Net Core 2.0 中的代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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