code-tutorial.com

The best resources for developers

Can MBUnit be used in TeamCity?

##teamcity[testSuiteStarted name="Test1"]
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text"/>
    <xsl:template match="/">

        <xsl:apply-templates/>

    </xsl:template>

    <xsl:template match="assemblies/assembly">
##teamcity[testSuiteStarted name="<xsl:value-of select="@name" />"]

        <xsl:apply-templates select="//run" />

##teamcity[testSuiteFinished name="<xsl:value-of select="@name" />"]
    </xsl:template>

    <xsl:template match="run">

        <xsl:choose>
            <xsl:when test="@result="ignore" or @result="skip"">
        ##teamcity[testIgnored name="<xsl:value-of select="@name" />" message="Test Ignored"]
            </xsl:when>
            <xsl:otherwise>
        ##teamcity[testStarted name="<xsl:value-of select="@name" />"]
            </xsl:otherwise>
        </xsl:choose>


        <xsl:if test="@result="failure"">
            ##teamcity[testFailed name="<xsl:value-of select="@name" />" message="<xsl:value-of select="child::node()/message"/>" details="<xsl:value-of select="normalize-space(child::node()/stack-trace)"/>"]
        </xsl:if>


        <xsl:if test="@result!="ignore" and @result!="skip"">
        ##teamcity[testFinished name="<xsl:value-of select="@name" />"]
        </xsl:if>

    </xsl:template>

</xsl:stylesheet>

Tags: nant mono teamcity mbunit

Source: By Scott Cowan as answer to the question

This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 2.5


Related code-snippets: