Here's what I came up with
How can I merge in the test report?
First you'll need to get mbunit to generate both an XML and HTML report. The Command line arguments look like this
/rt:Xml /rt:Html /rnf:mbunit /rf:..\reports
this will generate the reports into a dir called reports and the file will be called mbunit.xml and mbunit.html
next we want to add these files as artifacts on the build
build\reports\* => Reports
the last step is to tell teamcity to add it as a tab for the build
find the .BuildServer\config\main-config.xml and add this line
(on windows this is in c:\Documents and Settings\, on linux it was in the /root dir)
<report-tab title="Tests" basePath="Reports" startPage="mbunit.html" />
How can I display "Tests failed: 1 (1 new), passed: 3049" for the build?
TeamCity looks for a file called teamcity-info.xml where you can stick messages in to be displayed. The Actual test count is actually just plain text. I think you can just add the file as an artifact but I've also got it in the root dir of the build.
in NAnt you'll want to use this command to do an XSLT on the MBUnit XML Report
<style style="includes\teamcity-info.xsl" in="reports\mbunit.xml" out="..\teamcity-info.xml" />
the actual xsl looks like this.
(Note: that the { and } are reserved in xsl so we have to use params)
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="cbl" select="'{'"/>
<xsl:param name="cbr" select="'}'"/>
<xsl:template match="/">
<xsl:for-each select="report-result/counter">
<build number="1.0.{concat($cbl,'build.number',$cbr)}">
<xsl:if test="@failure-count > 0">
<statusInfo status="FAILURE">
<text action="append"> Tests failed: <xsl:value-of select="@failure-count"/>, passed: <xsl:value-of select="@success-count"/></text>
</statusInfo>
</xsl:if>
<xsl:if test="@failure-count = 0">
<statusInfo status="SUCCESS">
<text action="append"> Tests passed: <xsl:value-of select="@success-count"/></text>
</statusInfo>
</xsl:if>
</build>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
This will give you a file that looks like this
<build number="1.0.{build.number}">
<statusInfo status="FAILURE">
<text action="append">Tests failed: 16, passed: 88</text>
</statusInfo>
</build>