Skip to content

Commit

Permalink
Fix JENKINS-22041
Browse files Browse the repository at this point in the history
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 de6ee27
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -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
Expand Down

0 comments on commit de6ee27

Please sign in to comment.