如何在不使用visual studio屏幕的情况下从coverage文件中获取(%块)信息 [英] How can I get covered(% block) information from a coverage file without using visual studio screen
问题描述
我在另一个帐户中安装了Visual Studio 2017 Enterprise。当我通过在Visual Studio 2017企业命令提示符vstest.console.exe Fleck.Tests.dll中运行以下命令从控制台运行测试时,我收到以下消息:
I have Visual Studio 2017 Enterprise in another account. When I run the tests from console by running following command in Visual Studio 2017 Enterprise Command Prompt vstest.console.exe Fleck.Tests.dll, I get following message:
Microsoft(R)测试执行命令行工具版本15.3.0-preview-20170628-02
Microsoft (R) Test Execution Command Line Tool Version 15.3.0-preview-20170628-02
版权所有(c)Microsoft Corporation。保留所有权利。
Copyright (c) Microsoft Corporation. All rights reserved.
....
....
总测试:1。通过:1。失败:0。跳过:0。
Total tests: 1. Passed: 1. Failed: 0. Skipped: 0.
测试运行成功。
Test Run Successful.
测试执行时间:2.6671秒
Test execution time: 2.6671 Seconds
这是我使用的命令。
Here is the command I used.
使用命令:vstest.console.exe Fleck.Tests.dll /logger:trx;LogFileName=coverage.xml
Using Command : vstest.console.exe Fleck.Tests.dll /logger:trx;LogFileName=coverage.xml
没有关于的信息代码覆盖率。如何在vstest控制台上获得代码覆盖率输出?
There is no information about code coverage. How can I get code coverage output on vstest console?
推荐答案
嗨朋友,
我们可以使用这样的命令:vstest.console.exe Fleck.Tests.dll / logger:trx / Enablecodecoverage获取代码覆盖率输出。 (/ Enablecodecoverage:在测试运行中启用CodeCoverage)
We can use command like this: vstest.console.exe Fleck.Tests.dll /logger:trx /Enablecodecoverage to get the code coverage output. (/Enablecodecoverage: Enables CodeCoverage in the test run)
之后我们可以在附件中找到代码覆盖文件路径,如下所示:
After that we can find the code coverage file path in the attachments like below:
< img alt =""src ="https://social.msdn.microsoft.com/Forums/getfile/1394706">
此外:更多有关vstest.console.exe选项的详细信息,请访问:
VSTest.Console.exe命令行选项
In addition: More details about vstest.console.exe options can be found here: VSTest.Console.exe command-line options
希望以上所有内容都可以帮助解决此问题。期待您的回复!
Hope all above can help solve this issue. Looking forward to your reply!
最好的问候
Lance
这篇关于如何在不使用visual studio屏幕的情况下从coverage文件中获取(%块)信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!