diff --git a/changelog.html b/changelog.html
index 45f7318d9d..5740a6da7a 100644
--- a/changelog.html
+++ b/changelog.html
@@ -58,8 +58,6 @@ Upcoming changes
Fixed: tests with the same name are no longer counted correctly.
(issue 13214)
- Note that this reopens the bug:
- issue 12457
Added a tag to copy text into clipboard for plugins
diff --git a/core/src/main/java/hudson/tasks/junit/CaseResult.java b/core/src/main/java/hudson/tasks/junit/CaseResult.java
index 15cbbacc85..f1d59c997c 100644
--- a/core/src/main/java/hudson/tasks/junit/CaseResult.java
+++ b/core/src/main/java/hudson/tasks/junit/CaseResult.java
@@ -511,6 +511,10 @@ public final class CaseResult extends TestResult implements Comparable suites = testResult.getSuites();
-// assertEquals("Wrong number of test suites", 1, suites.size());
-
-
+ assertEquals("Wrong number of test suites", 1, testResult.getSuites().size());
assertEquals("Wrong number of test cases", 3, testResult.getTotalCount());
}
+
+ @Bug(12457)
+ public void testTestSuiteDistributedOverMultipleFilesIsCountedAsOne() throws IOException, URISyntaxException {
+ TestResult testResult = new TestResult();
+ testResult.parse(getDataFile("JENKINS-12457/TestSuite_a1.xml"));
+ testResult.parse(getDataFile("JENKINS-12457/TestSuite_a2.xml"));
+ testResult.tally();
+
+ assertEquals("Wrong number of testsuites", 1, testResult.getSuites().size());
+ assertEquals("Wrong number of test cases", 2, testResult.getTotalCount());
+ }
+
+ /**
+ * A common problem is that people parse TEST-*.xml as well as TESTS-TestSuite.xml.
+ * See http://jenkins.361315.n4.nabble.com/Problem-with-duplicate-build-execution-td371616.html for discussion.
+ */
+ public void testDuplicatedTestSuiteIsNotCounted() throws IOException, URISyntaxException {
+ TestResult testResult = new TestResult();
+ testResult.parse(getDataFile("JENKINS-12457/TestSuite_b.xml"));
+ testResult.parse(getDataFile("JENKINS-12457/TestSuite_b_duplicate.xml"));
+ testResult.tally();
+
+ assertEquals("Wrong number of testsuites", 1, testResult.getSuites().size());
+ assertEquals("Wrong number of test cases", 1, testResult.getTotalCount());
+ }
private static final XStream XSTREAM = new XStream2();
diff --git a/core/src/test/resources/hudson/tasks/junit/JENKINS-12457/TestSuite_a1.xml b/core/src/test/resources/hudson/tasks/junit/JENKINS-12457/TestSuite_a1.xml
new file mode 100644
index 0000000000..b27b131561
--- /dev/null
+++ b/core/src/test/resources/hudson/tasks/junit/JENKINS-12457/TestSuite_a1.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/core/src/test/resources/hudson/tasks/junit/JENKINS-12457/TestSuite_a2.xml b/core/src/test/resources/hudson/tasks/junit/JENKINS-12457/TestSuite_a2.xml
new file mode 100644
index 0000000000..cf2d21e0b9
--- /dev/null
+++ b/core/src/test/resources/hudson/tasks/junit/JENKINS-12457/TestSuite_a2.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/core/src/test/resources/hudson/tasks/junit/JENKINS-12457/TestSuite_b.xml b/core/src/test/resources/hudson/tasks/junit/JENKINS-12457/TestSuite_b.xml
new file mode 100644
index 0000000000..a754269a96
--- /dev/null
+++ b/core/src/test/resources/hudson/tasks/junit/JENKINS-12457/TestSuite_b.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/core/src/test/resources/hudson/tasks/junit/JENKINS-12457/TestSuite_b_duplicate.xml b/core/src/test/resources/hudson/tasks/junit/JENKINS-12457/TestSuite_b_duplicate.xml
new file mode 100644
index 0000000000..a754269a96
--- /dev/null
+++ b/core/src/test/resources/hudson/tasks/junit/JENKINS-12457/TestSuite_b_duplicate.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file