Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-41093] For Unittest++ xml, only the first failure of each te…
…st case is recognized Merge failure message into one.
- Loading branch information
Nikolas Falco
committed
Jun 6, 2018
1 parent
54707fa
commit 4e45887
Showing
13 changed files
with
368 additions
and
541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 22 additions & 23 deletions
45
src/main/java/org/jenkinsci/plugins/xunit/types/Valgrind.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 0 additions & 121 deletions
121
src/main/resources/org/jenkinsci/plugins/xunit/types/unittest-1.1-to-junit-1.0.xsl
This file was deleted.
Oops, something went wrong.
106 changes: 106 additions & 0 deletions
106
src/main/resources/org/jenkinsci/plugins/xunit/types/unittest-1.1-to-junit.xsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
The MIT License (MIT) | ||
Copyright (c) 2009, Gregory Boissinot | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
--> | ||
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xunit="http://www.xunit.org"> | ||
<xsl:output method="xml" indent="yes" encoding="UTF-8" cdata-section-elements="failure error system-out system-err"/> | ||
<xsl:decimal-format decimal-separator="." grouping-separator=","/> | ||
|
||
<xsl:function name="xunit:junit-time" as="xs:string"> | ||
<xsl:param name="value" as="xs:anyAtomicType?" /> | ||
|
||
<xsl:variable name="time" as="xs:double"> | ||
<xsl:choose> | ||
<xsl:when test="$value instance of xs:double"> | ||
<xsl:value-of select="$value" /> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:value-of select="translate(string($value), ',', '.')" /> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:variable> | ||
<xsl:value-of select="format-number($time, '0.000')" /> | ||
</xsl:function> | ||
|
||
<xsl:function name="xunit:if-empty" as="xs:string"> | ||
<xsl:param name="value" as="xs:string?" /> | ||
<xsl:param name="default" as="xs:anyAtomicType" /> | ||
<xsl:value-of select="if (string($value) != '') then string($value) else $default" /> | ||
</xsl:function> | ||
|
||
<xsl:template match="/"> | ||
<testsuite> | ||
<xsl:attribute name="errors"> | ||
<xsl:value-of select="unittest-results/@failedtests"/> | ||
</xsl:attribute> | ||
|
||
<xsl:attribute name="failures"> | ||
<xsl:value-of select="unittest-results/@failures"/> | ||
</xsl:attribute> | ||
|
||
<xsl:attribute name="tests"> | ||
<xsl:value-of select="unittest-results/@tests"/> | ||
</xsl:attribute> | ||
|
||
<xsl:attribute name="name">unittest</xsl:attribute> | ||
|
||
<xsl:variable name="testSuiteTime"> | ||
<xsl:value-of select="xunit:junit-time(xunit:if-empty(unittest-results/@time, 0))"/> | ||
</xsl:variable> | ||
|
||
<xsl:attribute name="timestamp"> | ||
<xsl:value-of select="$testSuiteTime"/> | ||
</xsl:attribute> | ||
|
||
<xsl:apply-templates select="/unittest-results/test"> | ||
<xsl:with-param name="testSuiteTime" select="$testSuiteTime" /> | ||
</xsl:apply-templates> | ||
</testsuite> | ||
</xsl:template> | ||
|
||
<xsl:template match="test"> | ||
<xsl:param name="testSuiteTime"/> | ||
|
||
<testcase> | ||
<xsl:attribute name="classname"> | ||
<xsl:value-of select="@suite"/> | ||
</xsl:attribute> | ||
|
||
<xsl:attribute name="name"> | ||
<xsl:value-of select="@name"/> | ||
</xsl:attribute> | ||
|
||
<xsl:attribute name="time"> | ||
<xsl:value-of select="xunit:junit-time(xunit:if-empty(@time, $testSuiteTime))"/> | ||
</xsl:attribute> | ||
|
||
<xsl:if test="failure"> | ||
<xsl:variable name="failureMessage"> | ||
<xsl:value-of select="string-join(failure/@message, ' ')" /> | ||
</xsl:variable> | ||
<failure message="{$failureMessage}" /> | ||
</xsl:if> | ||
</testcase> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |
Oops, something went wrong.