无法将覆盖结果发布到TFS [英] Cannot Publish Coverage Results onto TFS

查看:76
本文介绍了无法将覆盖结果发布到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 https://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

https://msdn.microsoft.com/en- IN / library / jj159530.aspx

问候

Starain


这篇关于无法将覆盖结果发布到TFS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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