Browse Source

Report skipped tests in junitreport - PR 54670

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1476552 13f79535-47bb-0310-9956-ffa450edef68
master
mclarke 12 years ago
parent
commit
df121979c0
3 changed files with 83 additions and 6 deletions
  1. +10
    -0
      src/etc/junit-frames-xalan1.xsl
  2. +56
    -5
      src/etc/junit-frames.xsl
  3. +17
    -1
      src/etc/junit-noframes.xsl

+ 10
- 0
src/etc/junit-frames-xalan1.xsl View File

@@ -443,6 +443,7 @@ h6 {
<xsl:variable name="testCount" select="sum(testsuite/@tests)"/>
<xsl:variable name="errorCount" select="sum(testsuite/@errors)"/>
<xsl:variable name="failureCount" select="sum(testsuite/@failures)"/>
<xsl:variable name="skippedCount" select="sum(testsuite/@skipped)"/>
<xsl:variable name="timeCount" select="sum(testsuite/@time)"/>
<xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/>
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
@@ -450,6 +451,7 @@ h6 {
<th>Tests</th>
<th>Failures</th>
<th>Errors</th>
<th>Skipped</th>
<th>Success rate</th>
<th>Time</th>
</tr>
@@ -464,6 +466,7 @@ h6 {
<td><xsl:value-of select="$testCount"/></td>
<td><xsl:value-of select="$failureCount"/></td>
<td><xsl:value-of select="$errorCount"/></td>
<td><xsl:value-of select="$skipCount" /></td>
<td>
<xsl:call-template name="display-percent">
<xsl:with-param name="value" select="$successRate"/>
@@ -507,6 +510,7 @@ h6 {
<td><xsl:value-of select="sum($insamepackage/@tests)"/></td>
<td><xsl:value-of select="sum($insamepackage/@errors)"/></td>
<td><xsl:value-of select="sum($insamepackage/@failures)"/></td>
<td><xsl:value-of select="sum($insamepackage/@skipped)" /></td>
<td>
<xsl:call-template name="display-time">
<xsl:with-param name="value" select="sum($insamepackage/@time)"/>
@@ -601,6 +605,7 @@ h6 {
<th>Tests</th>
<th>Errors</th>
<th>Failures</th>
<th>Skipped</th>
<th nowrap="nowrap">Time(s)</th>
<th nowrap="nowrap">Time Stamp</th>
<th>Host</th>
@@ -632,6 +637,7 @@ h6 {
<td><xsl:apply-templates select="@tests"/></td>
<td><xsl:apply-templates select="@errors"/></td>
<td><xsl:apply-templates select="@failures"/></td>
<td><xsl:apply-templates select="@skipped" /></td>
<td><xsl:call-template name="display-time">
<xsl:with-param name="value" select="@time"/>
</xsl:call-template>
@@ -660,6 +666,10 @@ h6 {
<td>Error</td>
<td><xsl:apply-templates select="error"/></td>
</xsl:when>
<xsl:when test="skipped">
<td>Skipped</td>
<td><xsl:apply-templates select="skipped"/></td>
</xsl:when>
<xsl:otherwise>
<td>Success</td>
<td></td>


+ 56
- 5
src/etc/junit-frames.xsl View File

@@ -79,6 +79,13 @@
<xsl:with-param name="type" select="'errors'"/>
</xsl:apply-templates>
</redirect:write>
<!-- create the alltests-skipped.html at the root -->
<redirect:write file="{$output.dir}/alltests-skipped.html">
<xsl:apply-templates select="." mode="all.tests">
<xsl:with-param name="type" select="'skipped'"/>
</xsl:apply-templates>
</redirect:write>

<!-- process all packages -->
<xsl:for-each select="./testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
@@ -154,6 +161,13 @@
</xsl:apply-templates>
</redirect:write>
</xsl:if>
<xsl:if test="@skipped != 0">
<redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-skipped.html">
<xsl:apply-templates select="." mode="class.details">
<xsl:with-param name="type" select="'skipped'"/>
</xsl:apply-templates>
</redirect:write>
</xsl:if>
</xsl:for-each>
</xsl:template>

@@ -229,7 +243,7 @@ h6 {
}
</xsl:template>

<!-- Create list of all/failed/errored tests -->
<!-- Create list of all/failed/errored/skipped tests -->
<xsl:template match="testsuites" mode="all.tests">
<xsl:param name="type" select="'all'"/>
<html>
@@ -241,6 +255,9 @@ h6 {
<xsl:when test="$type = 'errors'">
<xsl:text>All Errors</xsl:text>
</xsl:when>
<xsl:when test="$type = 'skipped'">
<xsl:text>All Skipped</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>All Tests</xsl:text>
</xsl:otherwise>
@@ -283,6 +300,11 @@ h6 {
<xsl:with-param name="show.class" select="'yes'"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$type = 'skipped'">
<xsl:apply-templates select=".//testcase[skipped]" mode="print.test">
<xsl:with-param name="show.class" select="'yes'"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select=".//testcase" mode="print.test">
<xsl:with-param name="show.class" select="'yes'"/>
@@ -362,6 +384,9 @@ h6 {
<xsl:when test="$type = 'errors'">
<h2>Errors</h2>
</xsl:when>
<xsl:when test="$type = 'skipped'">
<h2>Skipped</h2>
</xsl:when>
<xsl:otherwise>
<h2>Tests</h2>
</xsl:otherwise>
@@ -384,6 +409,9 @@ h6 {
<xsl:when test="$type = 'errors'">
<xsl:apply-templates select="./testcase[error]" mode="print.test"/>
</xsl:when>
<xsl:when test="$type = 'skipped'">
<xsl:apply-templates select="./testcase[skipped]" mode="print.test"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="./testcase" mode="print.test"/>
</xsl:otherwise>
@@ -563,6 +591,7 @@ h6 {
<xsl:variable name="testCount" select="sum(testsuite/@tests)"/>
<xsl:variable name="errorCount" select="sum(testsuite/@errors)"/>
<xsl:variable name="failureCount" select="sum(testsuite/@failures)"/>
<xsl:variable name="skippedCount" select="sum(testsuite/@skipped)" />
<xsl:variable name="timeCount" select="sum(testsuite/@time)"/>
<xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/>
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
@@ -570,6 +599,7 @@ h6 {
<th>Tests</th>
<th>Failures</th>
<th>Errors</th>
<th>Skipped</th>
<th>Success rate</th>
<th>Time</th>
</tr>
@@ -584,6 +614,7 @@ h6 {
<td><a title="Display all tests" href="all-tests.html"><xsl:value-of select="$testCount"/></a></td>
<td><a title="Display all failures" href="alltests-fails.html"><xsl:value-of select="$failureCount"/></a></td>
<td><a title="Display all errors" href="alltests-errors.html"><xsl:value-of select="$errorCount"/></a></td>
<td><a title="Display all skipped test" href="alltests-skipped.html"><xsl:value-of select="$skippedCount" /></a></td>
<td>
<xsl:call-template name="display-percent">
<xsl:with-param name="value" select="$successRate"/>
@@ -627,6 +658,7 @@ h6 {
<td><xsl:value-of select="sum($insamepackage/@tests)"/></td>
<td><xsl:value-of select="sum($insamepackage/@errors)"/></td>
<td><xsl:value-of select="sum($insamepackage/@failures)"/></td>
<td><xsl:value-of select="sum($insamepackage/@skipped)" /></td>
<td>
<xsl:call-template name="display-time">
<xsl:with-param name="value" select="sum($insamepackage/@time)"/>
@@ -721,6 +753,7 @@ h6 {
<th>Tests</th>
<th>Errors</th>
<th>Failures</th>
<th>Skipped</th>
<th nowrap="nowrap">Time(s)</th>
<th nowrap="nowrap">Time Stamp</th>
<th>Host</th>
@@ -763,8 +796,8 @@ h6 {
<xsl:apply-templates select="@errors"/>
</xsl:otherwise>
</xsl:choose>
</td>
<td>
</td>
<td>
<xsl:choose>
<xsl:when test="@failures != 0">
<a title="Display only failures" href="{@id}_{@name}-fails.html"><xsl:apply-templates select="@failures"/></a>
@@ -773,7 +806,17 @@ h6 {
<xsl:apply-templates select="@failures"/>
</xsl:otherwise>
</xsl:choose>
</td>
</td>
<td>
<xsl:choose>
<xsl:when test="@skipped != 0">
<a title="Display only skipped tests" href="{@id}_{@name}-skipped.html"><xsl:apply-templates select="@skipped"/></a>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="@skipped"/>
</xsl:otherwise>
</xsl:choose>
</td>
<td><xsl:call-template name="display-time">
<xsl:with-param name="value" select="@time"/>
</xsl:call-template>
@@ -819,6 +862,10 @@ h6 {
<td>Error</td>
<td><xsl:apply-templates select="error"/></td>
</xsl:when>
<xsl:when test="skipped">
<td>Skipped</td>
<td><xsl:apply-templates select="skipped"/></td>
</xsl:when>
<xsl:otherwise>
<td>Success</td>
<td></td>
@@ -833,7 +880,7 @@ h6 {
</xsl:template>


<!-- Note : the below template error and failure are the same style
<!-- Note : the below template skipped, error and failure are the same style
so just call the same style store in the toolkit template -->
<xsl:template match="failure">
<xsl:call-template name="display-failures"/>
@@ -843,6 +890,10 @@ h6 {
<xsl:call-template name="display-failures"/>
</xsl:template>

<xsl:template match="skipped">
<xsl:call-template name="display-failures"/>
</xsl:template>

<!-- Style for the error and failure in the testcase template -->
<xsl:template name="display-failures">
<xsl:choose>


+ 17
- 1
src/etc/junit-noframes.xsl View File

@@ -164,6 +164,7 @@
<xsl:variable name="testCount" select="sum($testsuites-in-package/@tests)"/>
<xsl:variable name="errorCount" select="sum($testsuites-in-package/@errors)"/>
<xsl:variable name="failureCount" select="sum($testsuites-in-package/@failures)"/>
<xsl:variable name="skippedCount" select="sum($testsuites-in-package/@skipped)" />
<xsl:variable name="timeCount" select="sum($testsuites-in-package/@time)"/>

<!-- write a summary for the package -->
@@ -179,6 +180,7 @@
<td><xsl:value-of select="$testCount"/></td>
<td><xsl:value-of select="$errorCount"/></td>
<td><xsl:value-of select="$failureCount"/></td>
<td><xsl:value-of select="$skippedCount" /></td>
<td>
<xsl:call-template name="display-time">
<xsl:with-param name="value" select="$timeCount"/>
@@ -253,6 +255,7 @@
<xsl:variable name="testCount" select="sum(testsuite/@tests)"/>
<xsl:variable name="errorCount" select="sum(testsuite/@errors)"/>
<xsl:variable name="failureCount" select="sum(testsuite/@failures)"/>
<xsl:variable name="skippedCount" select="sum(testsuite/@skipped)" />
<xsl:variable name="timeCount" select="sum(testsuite/@time)"/>
<xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/>
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
@@ -260,6 +263,7 @@
<th>Tests</th>
<th>Failures</th>
<th>Errors</th>
<th>Skipped</th>
<th>Success rate</th>
<th>Time</th>
</tr>
@@ -273,6 +277,7 @@
<td><xsl:value-of select="$testCount"/></td>
<td><xsl:value-of select="$failureCount"/></td>
<td><xsl:value-of select="$errorCount"/></td>
<td><xsl:value-of select="$skippedCount" /></td>
<td>
<xsl:call-template name="display-percent">
<xsl:with-param name="value" select="$successRate"/>
@@ -325,6 +330,7 @@
<th>Tests</th>
<th>Errors</th>
<th>Failures</th>
<th>Skipped</th>
<th nowrap="nowrap">Time(s)</th>
</tr>
</xsl:template>
@@ -336,6 +342,7 @@
<th>Tests</th>
<th>Errors</th>
<th>Failures</th>
<th>Skipped</th>
<th nowrap="nowrap">Time(s)</th>
<th nowrap="nowrap">Time Stamp</th>
<th>Host</th>
@@ -369,6 +376,7 @@
<td><xsl:value-of select="@tests"/></td>
<td><xsl:value-of select="@errors"/></td>
<td><xsl:value-of select="@failures"/></td>
<td><xsl:value-of select="@skipped" /></td>
<td>
<xsl:call-template name="display-time">
<xsl:with-param name="value" select="@time"/>
@@ -396,6 +404,10 @@
<td>Error</td>
<td><xsl:apply-templates select="error"/></td>
</xsl:when>
<xsl:when test="skipped">
<td>Skipped</td>
<td><xsl:apply-templates select="skipped"/></td>
</xsl:when>
<xsl:otherwise>
<td>Success</td>
<td></td>
@@ -418,7 +430,11 @@
<xsl:call-template name="display-failures"/>
</xsl:template>

<!-- Style for the error and failure in the tescase template -->
<xsl:template match="skipped">
<xsl:call-template name="display-failures"/>
</xsl:template>

<!-- Style for the error, failure and skipped in the testcase template -->
<xsl:template name="display-failures">
<xsl:choose>
<xsl:when test="not(@message)">N/A</xsl:when>


Loading…
Cancel
Save