in maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java [134:161]
public static void reportExecution(
SurefireReportParameters reportParameters,
RunResult result,
PluginConsoleLogger log,
Exception firstForkException)
throws MojoFailureException, MojoExecutionException {
boolean isError = firstForkException != null || result.isTimeout() || !result.isErrorFree();
boolean isTooFlaky = isTooFlaky(result, reportParameters);
if (!isError && !isTooFlaky) {
if (result.getCompletedCount() == 0 && failIfNoTests(reportParameters)) {
throw new MojoFailureException(
"No tests were executed! " + "(Set -DfailIfNoTests=false to ignore this error.)");
}
return;
}
if (reportParameters.isTestFailureIgnore()) {
String errorMessage = createErrorMessage(reportParameters, result, firstForkException);
if (firstForkException instanceof SurefireBooterForkException) {
throw new MojoExecutionException(errorMessage, firstForkException);
}
log.error(errorMessage);
} else {
throwException(reportParameters, result, firstForkException);
}
}