Skip to content

Commit

Permalink
print the failed tests at the end of the run
Browse files Browse the repository at this point in the history
  • Loading branch information
barrypitman committed May 1, 2022
1 parent 0459945 commit 39f485e
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.runner.Description;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;


Expand All @@ -26,5 +27,13 @@ public void testRunFinished(Result result) throws Exception {
result.getIgnoreCount() + " ignored, " +
(result.getRunCount() + result.getIgnoreCount())+ " total. " +
"Elapsed: " + elapsed + " seconds");

System.out.println("Failed tests: \n");
for (Failure failure : result.getFailures()) {
System.out.println(failure.toString());
failure.getException().printStackTrace(System.out);
System.out.println();
System.out.println();
}
}
}

0 comments on commit 39f485e

Please sign in to comment.