Skip to content

Commit

Permalink
Merge pull request #16820 from geoand/ct-bold-tests
Browse files Browse the repository at this point in the history
Make test failures more prominent in terminal output in continuous testing
  • Loading branch information
geoand authored Apr 27, 2021
2 parents 9653238 + 27dfc2c commit 8d94f6a
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,21 @@ public void runComplete(TestRunResults results) {
+ " were skipped. Tests took " + (results.getTotalTime())
+ "ms." + "\u001b[0m";
} else {
StringBuilder sb = new StringBuilder(
"\u001B[91mTest run failed, " + methodCount.get() + " tests were run, "
+ results.getCurrentFailing().size()
+ " failed, "
+ skipped.get()
+ " were skipped. Tests took " + results.getTotalTime() + "ms");
int failedTestsNum = results.getCurrentFailing().size();
boolean hasFailingTests = failedTestsNum > 0;
for (Map.Entry<String, TestClassResult> classEntry : results.getCurrentFailing().entrySet()) {
for (TestResult test : classEntry.getValue().getFailing()) {
log.error(
"Test " + test.getDisplayName() + " failed \n",
test.getTestExecutionResult().getThrowable().get());
}
}
lastStatus = sb.toString() + "\u001b[0m";
String output = String.format("Test run failed, %d tests were run, ", methodCount.get())
+ String.format("%s%d failed%s, ",
hasFailingTests ? "\u001B[1m" : "", failedTestsNum,
hasFailingTests ? "\u001B[2m" : "")
+ String.format("%d were skipped. Tests took %dms", skipped.get(), results.getTotalTime());
lastStatus = "\u001B[91m" + output + "\u001b[0m";
}
//this will re-print when using the basic console
promptHandler.setPrompt(RUNNING_PROMPT);
Expand Down

0 comments on commit 8d94f6a

Please sign in to comment.