Skip to content

Commit

Permalink
[FIXED JENKINS-8193] [FIXED JENKINS-4075] parse data driven tests, ac…
Browse files Browse the repository at this point in the history
…cording to the patch provided by toreolsensan
  • Loading branch information
nilleb committed Mar 13, 2015
1 parent b40c499 commit 22100ec
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/main/resources/hudson/plugins/mstest/mstest-to-junit.xsl
Expand Up @@ -5,7 +5,6 @@
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<testsuites>
<xsl:variable name="buildName" select="/a:TestRun/@name or /b:TestRun/@name"/>
<xsl:variable name="numberOfTests" select="sum(/a:TestRun/a:ResultSummary/a:Counters/@total | /b:TestRun/b:ResultSummary/b:Counters/@total)"/>
<xsl:variable name="numberOfFailures" select="sum(/a:TestRun/a:ResultSummary/a:Counters/@failed | /b:TestRun/b:ResultSummary/b:Counters/@failed)" />
<xsl:variable name="numberOfErrors" select="sum(/a:TestRun/a:ResultSummary/a:Counters/@error | /b:TestRun/b:ResultSummary/b:Counters/@error | /a:TestRun/a:ResultSummary/a:Counters/@timeout | /b:TestRun/b:ResultSummary/b:Counters/@timeout)" />
Expand All @@ -16,9 +15,21 @@
skipped="{$numberSkipped}">

<xsl:for-each select="//a:UnitTestResult">
<xsl:variable name="testName" select="@testName"/>
<xsl:variable name="executionId" select="@executionId"/>
<xsl:variable name="duration" select="@duration"/>
<xsl:variable name="testName">
<xsl:value-of select="@testName"/>
<xsl:if test="@dataRowInfo"> row <xsl:value-of select="@dataRowInfo"/></xsl:if>
</xsl:variable>
<xsl:variable name="executionId">
<xsl:choose>
<xsl:when test="@resultType = 'DataDrivenDataRow'">
<xsl:value-of select="@parentExecutionId"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@executionId"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="duration" select="@duration"/>
<xsl:variable name="outcome" select="@outcome"/>
<xsl:variable name="message" select="a:Output/a:ErrorInfo/a:Message"/>
<xsl:variable name="stacktrace" select="a:Output/a:ErrorInfo/a:StackTrace"/>
Expand Down Expand Up @@ -48,7 +59,10 @@
</xsl:for-each>

<xsl:for-each select="//b:UnitTestResult">
<xsl:variable name="testName" select="@testName"/>
<xsl:variable name="testName">
<xsl:value-of select="@testName"/>
<xsl:if test="@dataRowInfo"> row <xsl:value-of select="@dataRowInfo"/></xsl:if>
</xsl:variable>
<xsl:variable name="testId" select="@testId"/>
<xsl:variable name="duration" select="@duration"/>
<xsl:variable name="outcome" select="@outcome"/>
Expand Down Expand Up @@ -92,9 +106,7 @@
<xsl:variable name="duration_seconds" select="substring($duration, 7)"/>
<xsl:variable name="duration_minutes" select="substring($duration, 4, 2 )"/>
<xsl:variable name="duration_hours" select="substring($duration, 1, 2)"/>
<testcase classname="{$className}"
name="{$testName}"
>
<testcase classname="{$className}" name="{$testName}">
<xsl:if test="$duration">
<xsl:attribute name="time">
<xsl:value-of select="$duration_hours*3600 + $duration_minutes*60 + $duration_seconds"/>
Expand Down

0 comments on commit 22100ec

Please sign in to comment.