无法将覆盖结果发布到TFS

编程入门 行业动态 更新时间:2024-10-28 08:21:46
本文介绍了无法将覆盖结果发布到TFS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

为了将测试分发到不同的机器(远程方式),我们必须在从构建中运行测试时使用.testsettings文件。在此类文件中,我们配置为允许通过以下方式收集测试覆盖率数据:

In order to distribute the tests into different machine (remote way), we have to use the .testsettings file when running the tests from our build. In such file, we configure to enable to collect the test coverage data by:

<DataCollectors> <DataCollector uri="datacollector://microsoft/CodeCoverage/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TestTools.CodeCoverage.CoveragePlugIn, Microsoft.VisualStudio.QualityTools.Plugins.CodeCoverage, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="Code Coverage (Visual Studio 2010)"> <Configuration> <CodeCoverage keyFile="xxx.snk" xmlns=""> <Regular> <CodeCoverageItem binaryFile="xxx.dll" pdbFile="xxx.pdb" instrumentInPlace="true"

但问题是测试覆盖率数据从未发布回TFS服务器。在诊断构建过程时,测试结果已经可以根据构建日志发布:

But the problem is the test coverage data never published back to the TFS server. When diagnostics the build process, the test result already can be published according to the build log:

Results file: d:\Builds\xxxx.trx Test Settings: xxx Waiting to publish... Publishing results of test run xxx.trx to tfs.xxx/tfs/xxx... Publish completed successfully.

从TFS Web访问查看构建时,覆盖率为0%:

When view the build from the TFS web access, the coverage is 0%:

在调查根本原因时,我们在测试结果文件中找到了覆盖范围数据已经定义:

When investigate the root cause, we found inside the test result file, the coverage data is already defined:

<ResultSummary outcome="Completed"> <Counters total="396" executed="396" passed="396" error="0" failed="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" /> <ResultFiles> <ResultFile path="VM-DRSC01\data.coverage" /> <ResultFile path="VM-DRSC02\data.coverage" />

所以问题出在发布时,"发布者"和是不够聪明,不能分配这样的覆盖文件,并将覆盖结果放在正确的位置。

So the problem is when publish, the "publisher" is not smart enough to allocate such coverage file and put the coverage results into the right place.

如何解决问题?

有没有办法手动发布此类数据或将测试覆盖率结果写回TFS服务器通过一些TFS API或编码活动?

Is there any way to manually publish such data or write back the test coverage result back to the TFS server via some TFS API or coded activity?

推荐答案

嗨KZhaoMax,

您的TFS和VS版本是什么?

基于我在VS 2013中使用TFS 2013进行的测试,它运行良好。

请检查运行设置值类型是否为UserSpecified。

另一方面,请参阅下面的这篇文章再试一次(使用示例runsetting文件)

#自定义代码覆盖率分析

# Customizing Code Coverage Analysis

msdn.microsoft/en- IN / library / jj159530.aspx

问候

Starain

更多推荐

无法将覆盖结果发布到TFS

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

发布评论

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

>www.elefans.com

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