提交 1d249b98 编写于 作者: C Christoph Kutzinski

Added testcase and changelog for JENKINS-13214. The actual fix is in...

Added testcase and changelog for JENKINS-13214. The actual fix is in 7fba6527
上级 7fba6527
......@@ -55,6 +55,11 @@ Upcoming changes</a>
<!-- 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 class TestResultTest extends TestCase {
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();
......
<?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>
\ No newline at end of file
<?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>
\ No newline at end of file
<?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>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册