Skip to content
Permalink
Browse files
Fix JENKINS-22041
Added check to see if any tests failed this time that didn't fail last
time
  • Loading branch information
slide committed Apr 14, 2014
1 parent 7980566 commit de6ee279a67091fb58405193c9d9acc3a5e3ac89
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/main/java/hudson/plugins/emailext/plugins/trigger/RegressionTrigger.java
@@ -39,17 +39,23 @@ public boolean trigger(AbstractBuild<?, ?> build, TaskListener listener) {
if (build.getTestResultAction() == null)
return false;

// if previous run didn't have test results and this one does (with failures)
if (previousBuild.getTestResultAction() == null)
return build.getTestResultAction().getFailCount() > 0;

// if more tests failed during this run
if(build.getTestResultAction().getFailCount() >
previousBuild.getTestResultAction().getFailCount())
return true;

// if any test failed this time, but not last time
for (Object result : build.getTestResultAction().getFailedTests()){
CaseResult res = (CaseResult)result;
if (res.getAge() == 1)
return true;
}

return build.getTestResultAction().getFailCount() >
previousBuild.getTestResultAction().getFailCount();
return false;
}

@Extension

0 comments on commit de6ee27

Please sign in to comment.