Skip to content

Commit

Permalink
Improve JUnit XSD to be more surefire report compliant.
Browse files Browse the repository at this point in the history
  • Loading branch information
nfalco79 committed May 7, 2018
1 parent 88efbe0 commit 3f23643
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,12 @@ THE SOFTWARE.
</xs:choice>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="assertions" type="xs:string" use="optional"/>
<xs:attribute name="time" type="xs:string" use="optional"/>
<xs:attribute name="timestamp" type="xs:string" use="optional"/>
<xs:attribute name="classname" type="xs:string" use="optional"/>
<xs:attribute name="status" type="xs:string" use="optional"/>
<xs:attribute name="class" type="xs:string" use="optional"/>
<xs:attribute name="file" type="xs:string" use="optional"/>
<xs:attribute name="line" type="xs:string" use="optional"/>
<xs:attribute name="log" type="xs:string" use="optional"/>
<xs:attribute name="group" type="xs:string" use="optional"/>
<xs:attribute name="url" type="xs:string" use="optional"/>
Expand Down Expand Up @@ -138,7 +136,6 @@ THE SOFTWARE.
<xs:attribute name="hostname" type="xs:string" use="optional"/>
<xs:attribute name="id" type="xs:string" use="optional"/>
<xs:attribute name="package" type="xs:string" use="optional"/>
<xs:attribute name="assertions" type="xs:string" use="optional"/>
<xs:attribute name="file" type="xs:string" use="optional"/>
<xs:attribute name="skip" type="xs:string" use="optional"/>
<xs:attribute name="log" type="xs:string" use="optional"/>
Expand Down
62 changes: 44 additions & 18 deletions src/test/java/org/jenkinsci/plugins/xunit/types/JUnitTypeTest.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,60 @@
/*
* 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 java.util.Arrays;
import java.util.Collection;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

/**
* @author Gregory Boissinot
*/
@RunWith(Parameterized.class)
public class JUnitTypeTest extends AbstractTest {

@Test
public void testTestCase1() throws Exception {
convertAndValidate(JUnitInputMetric.class, "junit/testcase1/input.xml", "junit/testcase1/input.xml");
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] { { "test case 1", 1 }, //
{ "test case 2", 2 }, //
{ "test case 3", 3 }, //
{ "test case 4", 4 }, //
{ "test case 5", 5 }
});
}

@Test
public void testTestCase2() throws Exception {
convertAndValidate(JUnitInputMetric.class, "junit/testcase2/input.xml", "junit/testcase2/input.xml");
public JUnitTypeTest(String testName, int testNumber) {
super(JUnitInputMetric.class, resolveInput("junit", testNumber), resolveInput("junit", testNumber));
}

@Override
@Test
public void testTestCase3() throws Exception {
convertAndValidate(JUnitInputMetric.class, "junit/testcase3/input.xml", "junit/testcase3/input.xml");
public void verifyXSLT() throws Exception {
super.verifyXSLT();
}

@Test
public void testTestCase4() throws Exception {
convertAndValidate(JUnitInputMetric.class, "junit/testcase4/input.xml", "junit/testcase4/input.xml");
}

@Test
public void testTestCase5() throws Exception {
convertAndValidate(JUnitInputMetric.class, "junit/testcase5/input.xml", "junit/testcase5/input.xml");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" tests="2" skipped="0" assertions="5" time="0.243061" failures="0" name="SampleTest">
<testcase assertions="2" time="0.0253" name="test_two">
<testsuite errors="0" tests="2" skipped="0" time="0.243" failures="0" name="SampleTest">
<testcase time="0.025" name="test_two">
</testcase>
<testcase assertions="3" time="0.017303" name="test_one">
<testcase time="0.0173" name="test_one">
</testcase>
<system-out>
</system-out>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="FiltersTest"
file="/var/lib/jenkins/jobs/zend-grid-module/workspace/test-application/tests/FiltersTest.php" tests="32"
assertions="0" failures="0" errors="1" time="452.706041">
<testsuite name="FiltersTest: chrome" tests="16" assertions="0" failures="0" errors="0" time="208.783030">
failures="0" errors="1" time="452.706">
<testsuite name="FiltersTest: chrome" tests="16" failures="0" errors="0" time="208.783">
<testcase name="testOnFilterByDateBehavesLikeOr" class="FiltersTest"
file="/var/lib/jenkins/jobs/zend-grid-module/workspace/test-application/tests/FiltersTest.php"
line="10" assertions="0" time="20.951486"/>
time="20.951"/>
<testcase name="testFilterByTimestampsDoesntTakeIntoAccountTime" class="FiltersTest"
file="/var/lib/jenkins/jobs/zend-grid-module/workspace/test-application/tests/FiltersTest.php"
line="52" assertions="0" time="16.042006"/>
<testsuite name="FiltersTest::testFilterByNull" tests="5" assertions="0" failures="0" errors="0"
time="61.921692">
<testcase name="testFilterByNull with data set #0" assertions="0" time="11.880885"/>
<testcase name="testFilterByNull with data set #1" assertions="0" time="13.163355"/>
<testcase name="testFilterByNull with data set #2" assertions="0" time="12.258866"/>
<testcase name="testFilterByNull with data set #3" assertions="0" time="12.098506"/>
<testcase name="testFilterByNull with data set #4" assertions="0" time="12.520080"/>
time="16.042"/>
<testsuite name="FiltersTest::testFilterByNull" tests="5" failures="0" errors="0"
time="61.921">
<testcase name="testFilterByNull with data set #0" time="11.880"/>
<testcase name="testFilterByNull with data set #1" time="13.163"/>
<testcase name="testFilterByNull with data set #2" time="12.258"/>
<testcase name="testFilterByNull with data set #3" time="12.098"/>
<testcase name="testFilterByNull with data set #4" time="12.520"/>
</testsuite>
<testsuite name="FiltersTest::testFilterByNotNull" tests="4" assertions="0" failures="0" errors="0"
time="50.564510">
<testcase name="testFilterByNotNull with data set #0" assertions="0" time="12.819211"/>
<testcase name="testFilterByNotNull with data set #1" assertions="0" time="12.440420"/>
<testcase name="testFilterByNotNull with data set #2" assertions="0" time="12.710532"/>
<testcase name="testFilterByNotNull with data set #3" assertions="0" time="12.594347"/>
<testsuite name="FiltersTest::testFilterByNotNull" tests="4" failures="0" errors="0"
time="50.564">
<testcase name="testFilterByNotNull with data set #0" time="12.819"/>
<testcase name="testFilterByNotNull with data set #1" time="12.440"/>
<testcase name="testFilterByNotNull with data set #2" time="12.710"/>
<testcase name="testFilterByNotNull with data set #3" time="12.594"/>
</testsuite>
<testsuite name="FiltersTest::testNotEmptyDisablesOtherItems" tests="4" assertions="0" failures="0" errors="0"
time="47.358445">
<testcase name="testNotEmptyDisablesOtherItems with data set #0" assertions="0" time="11.748273"/>
<testcase name="testNotEmptyDisablesOtherItems with data set #1" assertions="0" time="11.702997"/>
<testcase name="testNotEmptyDisablesOtherItems with data set #2" assertions="0" time="11.997253"/>
<testcase name="testNotEmptyDisablesOtherItems with data set #3" assertions="0" time="11.909922"/>
<testsuite name="FiltersTest::testNotEmptyDisablesOtherItems" tests="4" failures="0" errors="0"
time="47.358">
<testcase name="testNotEmptyDisablesOtherItems with data set #0" time="11.748"/>
<testcase name="testNotEmptyDisablesOtherItems with data set #1" time="11.702"/>
<testcase name="testNotEmptyDisablesOtherItems with data set #2" time="11.997"/>
<testcase name="testNotEmptyDisablesOtherItems with data set #3" time="11.909"/>
</testsuite>
<testcase name="testMutuallyExclusiveBooleans" class="FiltersTest"
file="/var/lib/jenkins/jobs/zend-grid-module/workspace/test-application/tests/FiltersTest.php"
line="172" assertions="0" time="11.944891"/>
<testcase name="testMutuallyExclusiveBooleans" class="FiltersTest" file="/var/lib/jenkins/jobs/zend-grid-module/workspace/test-application/tests/FiltersTest.php" time="11.944"/>
</testsuite>
<testsuite name="FiltersTest: internet explorer" tests="16" assertions="0" failures="0" errors="1"
<testsuite name="FiltersTest: internet explorer" tests="16" failures="0" errors="1"
time="243.923011">
<testcase name="testOnFilterByDateBehavesLikeOr" class="FiltersTest"
file="/var/lib/jenkins/jobs/zend-grid-module/workspace/test-application/tests/FiltersTest.php"
line="10" assertions="0" time="34.795199"/>
time="34.795"/>
<testcase name="testFilterByTimestampsDoesntTakeIntoAccountTime" class="FiltersTest"
file="/var/lib/jenkins/jobs/zend-grid-module/workspace/test-application/tests/FiltersTest.php"
line="52" assertions="0" time="22.823278"/>
<testsuite name="FiltersTest::testFilterByNull" tests="5" assertions="0" failures="0" errors="1"
time="22.823"/>
<testsuite name="FiltersTest::testFilterByNull" tests="5" failures="0" errors="1"
time="79.679187">
<testcase name="testFilterByNull with data set #0" assertions="0" time="12.300125"/>
<testcase name="testFilterByNull with data set #1" assertions="0" time="33.122008">
<testcase name="testFilterByNull with data set #0" time="12.300"/>
<testcase name="testFilterByNull with data set #1" time="33.122">
<error type="PHPUnit_Extensions_Selenium2TestCase_WebDriverException">
FiltersTest::testFilterByNull with data set #1 ('publish_date', 1)
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: Unable to find element with xpath ==
Expand All @@ -73,26 +71,22 @@
/usr/share/php/PHPUnit/Extensions/Selenium2TestCase.php:258 /usr/bin/phpunit:46
</error>
</testcase>
<testcase name="testFilterByNull with data set #2" assertions="0" time="11.452066"/>
<testcase name="testFilterByNull with data set #3" assertions="0" time="10.645194"/>
<testcase name="testFilterByNull with data set #4" assertions="0" time="12.159794"/>
<testcase name="testFilterByNull with data set #2" time="11.452"/>
<testcase name="testFilterByNull with data set #3" time="10.645"/>
<testcase name="testFilterByNull with data set #4" time="12.159"/>
</testsuite>
<testsuite name="FiltersTest::testFilterByNotNull" tests="4" assertions="0" failures="0" errors="0"
time="47.550400">
<testcase name="testFilterByNotNull with data set #0" assertions="0" time="12.138109"/>
<testcase name="testFilterByNotNull with data set #1" assertions="0" time="11.949402"/>
<testcase name="testFilterByNotNull with data set #2" assertions="0" time="12.296412"/>
<testcase name="testFilterByNotNull with data set #3" assertions="0" time="11.166477"/>
<testsuite name="FiltersTest::testFilterByNotNull" tests="4" failures="0" errors="0" time="47.550">
<testcase name="testFilterByNotNull with data set #0" time="12.138"/>
<testcase name="testFilterByNotNull with data set #1" time="11.949"/>
<testcase name="testFilterByNotNull with data set #2" time="12.296"/>
<testcase name="testFilterByNotNull with data set #3" time="11.166"/>
</testsuite>
<testsuite name="FiltersTest::testNotEmptyDisablesOtherItems" tests="4" assertions="0" failures="0" errors="0"
time="44.270910">
<testcase name="testNotEmptyDisablesOtherItems with data set #0" assertions="0" time="10.235131"/>
<testcase name="testNotEmptyDisablesOtherItems with data set #1" assertions="0" time="10.975805"/>
<testcase name="testNotEmptyDisablesOtherItems with data set #2" assertions="0" time="11.049638"/>
<testcase name="testNotEmptyDisablesOtherItems with data set #3" assertions="0" time="12.010336"/>
<testsuite name="FiltersTest::testNotEmptyDisablesOtherItems" tests="4" failures="0" errors="0" time="44.270">
<testcase name="testNotEmptyDisablesOtherItems with data set #0" time="10.235"/>
<testcase name="testNotEmptyDisablesOtherItems with data set #1" time="10.975"/>
<testcase name="testNotEmptyDisablesOtherItems with data set #2" time="11.049"/>
<testcase name="testNotEmptyDisablesOtherItems with data set #3" time="12.010"/>
</testsuite>
<testcase name="testMutuallyExclusiveBooleans" class="FiltersTest"
file="/var/lib/jenkins/jobs/zend-grid-module/workspace/test-application/tests/FiltersTest.php"
line="172" assertions="0" time="14.804037"/>
<testcase name="testMutuallyExclusiveBooleans" class="FiltersTest" file="/var/lib/jenkins/jobs/zend-grid-module/workspace/test-application/tests/FiltersTest.php" time="14.804"/>
</testsuite>
</testsuite>

0 comments on commit 3f23643

Please sign in to comment.