Domanda

I've setup teamcity with my sln file and got the unit tests to show up with the CppUnit plugin that teamcity has. And I get test results in the TeamCity UI.

Now I'm trying to get trending reports to show up for my unit tests and code coverage.

As of code coverage, we're using vsinstr.exe and vsperfmon.exe which produces an XML file.

I'm not quite sure as of what steps I should be taking to make the trending reports and code coverage(not as important) to show up.

I've already seen this post, but the answer seems to require editing the build script, which I don't think would work for my case since I'm building through MSBuild and the .sln file, and the tests are being ran through that build.

So basically I'm trying to get the Statistics tab to show up, and I'm not sure where to begin.

È stato utile?

Soluzione

Just add simple Powershell step into your build configuration. Something like this:

function TeamCity-SetBuildStatistic([string]$key, [string]$value) {
    Write-Output "##teamcity[buildStatisticValue key='$key' value='$value']"
}

$outputFile = 'MetricsResults.xml'

$xml = [xml] (Get-Content $outputFile)

$metrics = $xml.CodeMetricsReport.Targets.Target[0].Modules.Module.Metrics
$metrics.Metric 
  | foreach { TeamCity-SetBuildStatistic "$($_.Name)" $_.Value.Replace(',', '') }

It uses XML output from FxCop Metrics. You have to update the script for your actual schema.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top