Skip to content

Commit

Permalink
[JENKINS-35660] QTestLib time information is lost
Browse files Browse the repository at this point in the history
Use a converter function in XSLT to convert msec attribute of duration
element for QtTest
  • Loading branch information
kpop committed May 3, 2018
1 parent 9621193 commit 5d79a70
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
Expand Up @@ -42,7 +42,7 @@ THE SOFTWARE.
<xsl:variable name="msecsTest">
<xsl:choose>
<xsl:when test="Duration">
<xsl:value-of select="Duration/@msecs"/>
<xsl:value-of select="translate(Duration/@msecs,',','.')"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
Expand All @@ -68,7 +68,7 @@ THE SOFTWARE.
<xsl:variable name="msecsFunction">
<xsl:choose>
<xsl:when test="Duration">
<xsl:value-of select="Duration/@msecs"/>
<xsl:value-of select="translate(Duration/@msecs,',','.')"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
Expand Down
@@ -1,6 +1,30 @@
/*
* The MIT License
*
* Copyright (c) 2014, 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.
*/
package org.jenkinsci.plugins.xunit.types;

import org.junit.Test;
import org.jvnet.hudson.test.Issue;

/**
* @author Gregory Boissinot
Expand All @@ -17,4 +41,10 @@ public void testTestCase2() throws Exception {
convertAndValidate(QTestLibInputMetric.class, "qtestlib/testcase2/input.xml", "qtestlib/testcase2/result.xml");
}

@Issue("JENKINS-35660")
@Test
public void verify_that_duration_converted_correctly() throws Exception {
convertAndValidate(QTestLibInputMetric.class, "qtestlib/testcase2/input.xml", "qtestlib/testcase2/result.xml");
}

}
@@ -0,0 +1,19 @@
<TestCase name="MyTests">
<Environment>
<QtVersion>5.3.2</QtVersion>
<QTestVersion>5.3.2</QTestVersion>
</Environment>
<TestFunction name="durationInteger">
<Incident type="pass" file="" line="0" />
<Duration msecs="1" />
</TestFunction>
<TestFunction name="durationFloatDot">
<Incident type="pass" file="" line="0" />
<Duration msecs="1.567" />
</TestFunction>
<TestFunction name="durationFloatComma">
<Incident type="pass" file="" line="0" />
<Duration msecs="1,567" />
</TestFunction>
<Duration msecs="4,134" />
</TestCase>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="tst_QString" tests="118" failures="0" errors="0" time="0.000">
<properties>
<property name="QtVersion" value="5.3.2"/>
<property name="QTestVersion" value="5.3.2"/>
</properties>
<testcase classname="MyTests" name="assignQLatin1String" time="1"/>
<testcase classname="MyTests" name="isRightToLeft" time="1.567"/>
<testcase classname="MyTests" name="cleanupTestCase" time="1.567"/>
<system-out/>
<system-err/>
</testsuite>

0 comments on commit 5d79a70

Please sign in to comment.