Skip to content
Permalink
Browse files
Added testcase and changelog for JENKINS-13214. The actual fix is in 7…
  • Loading branch information
kutzi committed Apr 6, 2012
1 parent 7fba652 commit 1d249b98fb2a70f31b27849898e5d50dd5b018a4
@@ -55,6 +55,11 @@
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=bug>
Fixed: tests with the same name are no longer counted correctly.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-13214">issue 13214</a>)
Note that this reopens the bug:
<a href="https://issues.jenkins-ci.org/browse/JENKINS-12457">issue 12457</a>
<li class=rfe>
Added a tag to copy text into clipboard for plugins
<li class=rfe>
@@ -23,18 +23,24 @@
*/
package hudson.tasks.junit;

import com.thoughtworks.xstream.XStream;
import hudson.XmlFile;
import hudson.util.HeapSpaceStringConverter;
import hudson.util.XStream2;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Collection;
import java.util.List;

import junit.framework.TestCase;

import org.jvnet.hudson.test.Bug;

import com.thoughtworks.xstream.XStream;

/**
* Tests the JUnit result XML file parsing in {@link TestResult}.
*
* @author dty
*/
@@ -93,6 +99,27 @@ public void testXmlCompatibility() throws Exception {
assertFalse(failedCase.isPassed());
assertEquals(5, failedCase.getFailedSince());
}

/**
* When test methods are parametrized, they can occur multiple times in the testresults XMLs.
* Test that these are counted correctly.
*/
@Bug(13214)
public void testDuplicateTestMethods() throws IOException, URISyntaxException {
TestResult testResult = new TestResult();
testResult.parse(getDataFile("JENKINS-13214/27449.xml"));
testResult.parse(getDataFile("JENKINS-13214/27540.xml"));
testResult.parse(getDataFile("JENKINS-13214/29734.xml"));
testResult.tally();

// Ideally the suites should be merged as they are logically the same, but that doesn't work, yet
// See also JENKINS-12457
// Collection<SuiteResult> suites = testResult.getSuites();
// assertEquals("Wrong number of test suites", 1, suites.size());


assertEquals("Wrong number of test cases", 3, testResult.getTotalCount());
}

private static final XStream XSTREAM = new XStream2();

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><testsuite name="nosetests" tests="1" errors="0" failures="0" skip="0"><testcase classname="TestConsultationAcceptance.ConsultationCreationAcceptance" name="testConsultationAcceptance" time="157.980" /></testsuite>
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><testsuite name="nosetests" tests="1" errors="0" failures="0" skip="0"><testcase classname="TestConsultationAcceptance.ConsultationCreationAcceptance" name="testConsultationAcceptance" time="146.368" /></testsuite>
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><testsuite name="nosetests" tests="1" errors="0" failures="0" skip="0"><testcase classname="TestConsultationAcceptance.ConsultationCreationAcceptance" name="testConsultationAcceptance" time="153.027" /></testsuite>

0 comments on commit 1d249b9

Please sign in to comment.