Skip to content
Permalink
Browse files

Merge pull request #63 from slide/master

Fix JENKINS-41134
  • Loading branch information...
slide committed Jan 27, 2017
2 parents 90e7ddb + 3b99c65 commit 631c41350f6eb24520af19083a9f2fe27163f572
@@ -277,6 +277,7 @@ void merge(TestResult other) {
suite.setParent(null); // otherwise freeze ignores it
add(suite);
}
tally();
}

private boolean strictEq(Object lhs, Object rhs) {
@@ -150,6 +150,27 @@ public void testDuplicatedTestSuiteIsNotCounted() throws IOException, URISyntaxE
assertEquals("Wrong duration for test result", 1.0, testResult.getDuration(), 0.01);
}

@Issue("JENKINS-41134")
@Test
public void testMerge() throws IOException, URISyntaxException {
TestResult first = new TestResult();
TestResult second = new TestResult();

first.parse(getDataFile("JENKINS-41134/TestSuite_first.xml"));
second.parse(getDataFile("JENKINS-41134/TestSuite_second.xml"));
assertEquals("Fail count should be 0", 0, first.getFailCount());
first.merge(second);
assertEquals("Fail count should now be 1", 1, first.getFailCount());

first = new TestResult();
second = new TestResult();
first.parse(getDataFile("JENKINS-41134/TestSuite_first.xml"));
second.parse(getDataFile("JENKINS-41134/TestSuite_second_dup_first.xml"));
assertEquals("Fail count should be 0", 0, first.getFailCount());
first.merge(second);
assertEquals("Fail count should now be 1", 1, first.getFailCount());
}

private static final XStream XSTREAM = new XStream2();

static {
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="TestSuite_first" tests="1" errors="0" failures="0" skip="0" timestamp="2012-04-05T10:50:00">
<testcase classname="TestFoo" name="bar" time="157.980" />
</testsuite>
</testsuites>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="TestSuite_second" tests="1" errors="0" failures="1" skip="0" timestamp="2012-04-05T10:50:00">
<testcase classname="TestFoo2" name="bar2" time="123.980">
<failure message="PROGRAM.cbl:2 Use a program name that matches the source file name" type="WARNING">
WARNING: Use a program name that matches the source file name
Category: COBOL Code Review – Naming Conventions
File: /project/PROGRAM.cbl
Line: 2
</failure>
</testcase>
</testsuite>
</testsuites>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="TestSuite_first" tests="1" errors="0" failures="1" skip="0" timestamp="2012-04-05T10:55:00">
<testcase classname="TestFoo" name="bar" time="157.980">
<failure message="PROGRAM.cbl:2 Use a program name that matches the source file name" type="WARNING">
WARNING: Use a program name that matches the source file name
Category: COBOL Code Review – Naming Conventions
File: /project/PROGRAM.cbl
Line: 2
</failure>
</testcase>
</testsuite>
</testsuites>

0 comments on commit 631c413

Please sign in to comment.
You can’t perform that action at this time.