diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java index 328d1a12e2b13..30fad8206dfdf 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java @@ -339,6 +339,12 @@ public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult.failed(failure), List.of(), false, runId, 0, false)); results.put(UniqueId.parse(currentNonDynamicTest.get().getUniqueId()), result); + } else if (testExecutionResult.getStatus() == TestExecutionResult.Status.FAILED) { + Throwable throwable = testExecutionResult.getThrowable().get(); + trimStackTrace(testClass, throwable); + for (var i : throwable.getSuppressed()) { + trimStackTrace(testClass, i); + } } } else if (testExecutionResult.getStatus() == TestExecutionResult.Status.FAILED) { //if a parent fails we fail the children diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java index 9225b2b8fc46d..539cdc22c7cdd 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java @@ -217,6 +217,7 @@ public void runComplete(TestRunResults results) { } else { currentlyFailing = true; //TODO: this should not use the logger, it should print a nicer status + //first print the full failures log.error(statusHeader("TEST REPORT #" + results.getId())); for (Map.Entry classEntry : results.getCurrentFailing().entrySet()) { for (TestResult test : classEntry.getValue().getFailing()) { @@ -227,6 +228,36 @@ public void runComplete(TestRunResults results) { } } } + //then print the summary + StringBuilder summary = new StringBuilder(statusFooter(RED + "Summary:") + "\n"); + for (Map.Entry classEntry : results.getCurrentFailing().entrySet()) { + for (TestResult test : classEntry.getValue().getFailing()) { + if (test.isReportable()) { + StackTraceElement testclass = null; + for (var i : test.getTestExecutionResult().getThrowable().get().getStackTrace()) { + if (i.getClassName().equals(test.testClass)) { + testclass = i; + break; + } + } + + if (summary.charAt(summary.length() - 1) != '\n') { + summary.append("\n"); + } + if (testclass != null) { + summary.append(testclass.getClassName() + "#" + testclass.getMethodName() + "(" + + testclass.getFileName() + ":" + testclass.getLineNumber() + ") "); + } + summary.append(RED + + test.getDisplayName() + RESET + + " " + test.getTestExecutionResult().getThrowable().get().getMessage()); + } + } + } + while (summary.charAt(summary.length() - 1) == '\n') { + summary.setLength(summary.length() - 1); + } + log.error(summary.toString()); log.error( statusFooter(RED + results.getCurrentFailedCount() + " " + pluralize("TEST", "TESTS", results.getCurrentFailedCount()) + " FAILED")); diff --git a/extensions/websockets/server/deployment/src/test/java/io/quarkus/websockets/test/WebsocketDevModeTestCase.java b/extensions/websockets/server/deployment/src/test/java/io/quarkus/websockets/test/WebsocketDevModeTestCase.java index 43b80163ec843..bc7aaac5fe6a9 100644 --- a/extensions/websockets/server/deployment/src/test/java/io/quarkus/websockets/test/WebsocketDevModeTestCase.java +++ b/extensions/websockets/server/deployment/src/test/java/io/quarkus/websockets/test/WebsocketDevModeTestCase.java @@ -13,6 +13,7 @@ import javax.websocket.Session; import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.StringAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -26,7 +27,7 @@ */ public class WebsocketDevModeTestCase { - @TestHTTPResource("echo") + @TestHTTPResource("api/echo") URI echoUri; @RegisterExtension @@ -35,7 +36,8 @@ public class WebsocketDevModeTestCase { @Override public JavaArchive get() { return ShrinkWrap.create(JavaArchive.class) - .addClasses(EchoWebSocket.class, EchoService.class); + .addClasses(EchoWebSocket.class, EchoService.class) + .addAsResource(new StringAsset("quarkus.http.root-path=/api/"), "application.properties"); } });