提交 9bc7e21d 编写于 作者: C Christoph Kutzinski

[FIXED JENKINS-7970] JUnit result archiver should only fail builds if there...

[FIXED JENKINS-7970] JUnit result archiver should only fail builds if there are really no results - i.e. also no skipped tests.
上级 809fa1f5
......@@ -55,7 +55,9 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=>
<li class=bug>
JUnit result archiver should only fail builds if there are really no results - i.e. also no skipped tests.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-7970">issue 7970</a>)
</ul>
</div><!--=TRUNK-END=-->
......
......@@ -57,7 +57,6 @@ import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
......@@ -139,8 +138,10 @@ public class JUnitResultArchiver extends Recorder implements MatrixAggregatable
throw new AbortException(Messages.JUnitResultArchiver_BadXML(testResults));
}
result.freeze(action);
if (result.getPassCount() == 0 && result.getFailCount() == 0)
if (result.isEmpty()) {
// most likely a configuration error in the job - e.g. false pattern to match the JUnit result files
throw new AbortException(Messages.JUnitResultArchiver_ResultIsEmpty());
}
// TODO: Move into JUnitParser [BUG 3123310]
List<Data> data = new ArrayList<Data>();
......
......@@ -377,6 +377,15 @@ public final class TestResult extends MetaTabulatedResult {
public int getSkipCount() {
return skippedTests;
}
/**
* Returns <tt>true</tt> if this doesn't have any any test results.
* @since 1.511
*/
@Exported(visibility=999)
public boolean isEmpty() {
return getTotalCount() == 0;
}
@Override
public List<CaseResult> getFailedTests() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册