1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-15 00:32:06 +01:00

[sinttest] Perform early exit in JulTestRunResultProcessor.process()

This commit is contained in:
Florian Schmaus 2024-10-17 22:07:37 +02:00
parent d67262a5e0
commit 18647c24ca

View file

@ -150,27 +150,28 @@ public class SmackIntegrationTestFramework {
LOGGER.info("SmackIntegrationTestFramework[" + testRunResult.testRunId + ']' + " finished: " LOGGER.info("SmackIntegrationTestFramework[" + testRunResult.testRunId + ']' + " finished: "
+ successfulTests + '/' + availableTests + " [" + failedTests + " failed]"); + successfulTests + '/' + availableTests + " [" + failedTests + " failed]");
if (failedTests > 0) { if (failedTests == 0) {
StringBuilder sb = new StringBuilder("💀 The following " + failedTests + " tests failed! 💀\n -"); LOGGER.info("All possible Smack Integration Tests completed successfully. \\o/");
StringUtils.appendTo(testRunResult.failedIntegrationTests, "\n- ", sb, t -> sb.append(t.concreteTest)); return;
LOGGER.warning(sb.toString()); }
final SortedSet<String> bySpecification = new TreeSet<>(); StringBuilder sb = new StringBuilder("💀 The following " + failedTests + " tests failed! 💀\n -");
for (FailedTest failedTest : testRunResult.failedIntegrationTests) { StringUtils.appendTo(testRunResult.failedIntegrationTests, "\n- ", sb, t -> sb.append(t.concreteTest));
final Throwable cause = failedTest.failureReason; LOGGER.warning(sb.toString());
LOGGER.log(Level.SEVERE, failedTest.concreteTest + " failed: " + cause, cause);
if (failedTest.concreteTest.method.getDeclaringClass().isAnnotationPresent(SpecificationReference.class)) { final SortedSet<String> bySpecification = new TreeSet<>();
final String specificationReference = getSpecificationReference(failedTest.concreteTest.method); for (FailedTest failedTest : testRunResult.failedIntegrationTests) {
if (specificationReference != null) { final Throwable cause = failedTest.failureReason;
bySpecification.add("- " + specificationReference + " (as tested by '" + failedTest.concreteTest + "')"); LOGGER.log(Level.SEVERE, failedTest.concreteTest + " failed: " + cause, cause);
} if (failedTest.concreteTest.method.getDeclaringClass().isAnnotationPresent(SpecificationReference.class)) {
final String specificationReference = getSpecificationReference(failedTest.concreteTest.method);
if (specificationReference != null) {
bySpecification.add("- " + specificationReference + " (as tested by '" + failedTest.concreteTest + "')");
} }
} }
if (!bySpecification.isEmpty()) { }
LOGGER.log(Level.SEVERE, "The failed tests correspond to the following specifications:" + System.lineSeparator() + String.join(System.lineSeparator(), bySpecification)); if (!bySpecification.isEmpty()) {
} LOGGER.log(Level.SEVERE, "The failed tests correspond to the following specifications:" + System.lineSeparator() + String.join(System.lineSeparator(), bySpecification));
} else {
LOGGER.info("All possible Smack Integration Tests completed successfully. \\o/");
} }
} }
} }