For our latest product, we’ve switched over from CC.NET to the excellent TeamCity continuous integration server from JetBrains, which, as of version 3, is free for small projects like ours. One of the nice aspects of TC is that it’s very easy to publish data from your build (such as number of unit test passes / failures) so that it gets picked up by the TC server.
To help us along, we’ve written a few simple MSBuild tasks which do just that. We’ve created a sourceforge project for them, but until that’s activated, you can download them here.
There are currently 3 tasks:
MSBuild.TeamCity.Tasks.TeamCityAppendStatusText
Appends text to be displayed in the build status when the build is complete - e.g. “Tests Passed: 3, Tests Failed: 1″
Example usage:
<TeamCityAppendStatusText TeamCityInfoPath="$(teamcity_build_checkoutDir)\teamcity-info.xml" Value="Tests Passed: 3" />
<TeamCityAppendStatusText TeamCityInfoPath="$(teamcity_build_checkoutDir)\teamcity-info.xml" Value="Tests Failed: 1" />
MSBuild.TeamCity.Tasks.TeamCityAddStatistic
Adds a build statistic that can be picked up for graphing by configuring TeamCity’s main-config.xml (see here).
Example usage:
<TeamCityAddStatistic TeamCityInfoPath="$(teamcity_build_checkoutDir)\teamcity-info.xml" Key="TestsPassed" Value="3" />
<TeamCityAddStatistic TeamCityInfoPath="$(teamcity_build_checkoutDir)\teamcity-info.xml" Key="TestsFailed" Value="1" />
MSBuild.TeamCity.Tasks.TeamCityAddStatisticList
Variation on the above which allows you to add multiple statistics at once. Each key/ value pair is delimited by ‘;’
Example usage:
<TeamCityAddStatisticList TeamCityInfoPath="$(teamcity_build_checkoutDir)\teamcity-info.xml" KeyValuePairs="TestsPassed=3;TestsFailed=1" />
Thats pretty much it for now asĀ that’s all we’re using. I’ll post a follow up shortly to show how you can use these to pull in results from MbUnit tests.
If you missed the link above, you can download the tasks here.
5 responses so far ↓
Elizaveta // January 25, 2008 at 9:30 am
Thank you so much for your positive feedback.
We are really glad you managed to implement custom builds’ data publishing and share your knowledge with others.
The JetBrains TeamCity Team
Petar Petrov // January 29, 2008 at 4:04 pm
Great article. Please provide a serie with more details on MSBuild, TeamCity and how to setup a new project.
Brett Veenstra // March 7, 2008 at 2:25 pm
Great stuff here… I’m definitely interested in how you hooked this into your MSBuild script (although we’re going to use NANT for now).
Eugene Petrenko // June 25, 2008 at 10:05 am
Unfortunatly the link to the soureces is dead not. Is there any other way for achieving it. I believe it would be possible to posting those code in TeamCity plugins repository.
Will // July 1, 2008 at 11:34 am
Thanks Eugene - have fixed that link now.
Leave a Comment