Skip to content

Commit

Permalink
[JENKINS-51481] Parse error occur when NUnit report have categories
Browse files Browse the repository at this point in the history
Improve testcase name when trim testsuite name.
  • Loading branch information
nfalco79 committed May 27, 2018
1 parent b45f561 commit d714f7a
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 160 deletions.

This file was deleted.

Expand Up @@ -145,11 +145,11 @@ THE SOFTWARE.
<xsl:for-each select="*/test-case">
<xsl:variable name="testName">
<xsl:choose>
<xsl:when test="contains(@name, concat($suiteName, '.'))">
<xsl:when test="starts-with(@name, concat($suiteName, '.'))">
<xsl:value-of select="substring(@name, string-length($suiteName) + 2)"/>
</xsl:when>
<xsl:when test="contains(@name, $suiteName)">
<xsl:value-of select="substring-after(@name, $suiteName)"/>
<xsl:when test="starts-with(@name, $suiteName)">
<xsl:value-of select="substring(@name, string-length($suiteName) + 1)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
Expand Down
Expand Up @@ -102,7 +102,12 @@ protected void convertAndValidate(Class<? extends InputMetric> metricClass, Stri
inputMetric.convert(inputXMLFile, outputXMLFile);
XMLUnit.setIgnoreWhitespace(true);
Diff myDiff = new Diff(readXmlAsString(outputXMLFile), readXmlAsString(new File(this.getClass().getResource(expectedResultPath).toURI())));
try {
Assert.assertTrue("XSL transformation did not work " + myDiff, myDiff.similar());
} catch (Error e) {
System.err.println(readXmlAsString(outputXMLFile));
throw e;
}

//The generated output file must be valid
boolean outputResult = inputMetric.validateOutputFile(outputXMLFile);
Expand Down
Expand Up @@ -45,7 +45,9 @@ public static Collection<Object[]> data() {
{ "JENKINS-10911 skipped are ignored when failure is present before", 7 }, //
{ "Sample provided by http://nunit.org/files/testresult_25.txt", 8 }, //
{ "Sample provided by the 2.4.8 distribution", 9 }, //
{ "JENKINS-51481 report produced by DUnit to NUnit logger", 10 }
{ "JENKINS-51481 report produced by DUnit to NUnit logger", 10 }, //
{ "JENKINS-JENKINS-51556 works", 11 }, //
{ "JENKINS-JENKINS-51556 cause JEP-200 issue", 12 } //
});
}

Expand Down

0 comments on commit d714f7a

Please sign in to comment.