Statistics Publisher

The publisher can be used to collect and update statistics for each build in a file. Some of the statistics which would be collected are build durations and test count. At the minimal, the publisher can be configured with just an empty <statistics /> element in the publishers section. This would pick up some default statistics for capturing during the build process.

info

Statistics publisher must come after any File Merge tasks in the publishers section, in case you want to collect statistics from merged files.

The task will generate a statistics.csv and report.xml file in the artifact directory.

Version

Available from version 1.0

Examples

Minimalist example

1<statistics />

Configuration Elements

Element Description Type Required Default Version
statisticList The list of statistics to be included in the build.
There is a default list of statistics to be included, and this list adds additional statistics to the build. Any statistic defined with include=false will be omitted, even if it is in the default list.
Statistics array No None 1.0
description Description used for the visualisation of the buildstage, if left empty the process name will be shown. String No The task/publisher name. 1.5
dynamicValues The dynamic values to use for the task. Dynamic Values array No None 1.5
environment A set of environment variables set for commands that are executed.
Each variable should be specified as
1<variable name="name" value="value" />

.
Environment Variable array No

Notes

If you want to specify your own, or override the default statistics, it is possible to do so by supplying the name and xpath for the statistics and the corresponding location in the build log to pick the data from.

1<statistics>
2  <statisticList>
3    <statistic name="metric_name" xpath="xpath expression" />
4    <firstMatch name="metric_name" xpath="xpath expression" />
5  </statisticList>
6</statistics>

It is also possible to optionally configure the statistics publisher to generate charts for any metric against different builds, and to even remove them altogether. This feature has been added in version 1.3:

1<statistics>
2  <statisticList>
3    <statistic name="metric_name" xpath="xpath expression" generateGraph="true" include="true" />
4    <firstMatch name="metric_name" xpath="xpath expression" include="false" />
5  </statisticList>
6</statistics>

 1<statistics>
 2  <statisticList>
 3    <statistic name="AmountOfFailures" xpath="sum(//test-results/@failures)" />
 4    <firstMatch name="AmountOfTests" xpath="//mstest:TestRun/mstest:ResultSummary/mstest:Counters/@total">
 5      <namespaces>
 6        <namespaceMapping prefix="mstest" url="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" />
 7      </namespaces>
 8    </firstMatch>
 9  </statisticList>
10</statistics>

For the statistics configured with 'generateGraph="true"', a graph is generated with different builds on x-axis and the configured metric on y-axis in the artifacts directory named as <statistic name>.png. This chart would still be a very basic representation. For now at least, exporting the report to Excel for charting/analyis might be a better option.

Automatically Generated

Documentation generated on Monday, 26 May 2014 at 7:18:01 AM