Skip to content

Commit

Permalink
Merge pull request quarkusio#25845 from stuartwdouglas/ct-output
Browse files Browse the repository at this point in the history
Improve continuous testing output
  • Loading branch information
gsmet authored Jun 21, 2022
2 parents 698b5c6 + 4dea8f4 commit 560ad1c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, TestClassResult> classEntry : results.getCurrentFailing().entrySet()) {
for (TestResult test : classEntry.getValue().getFailing()) {
Expand All @@ -227,6 +228,36 @@ public void runComplete(TestRunResults results) {
}
}
}
//then print the summary
StringBuilder summary = new StringBuilder(statusFooter(RED + "Summary:") + "\n");
for (Map.Entry<String, TestClassResult> 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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,7 +27,7 @@
*/
public class WebsocketDevModeTestCase {

@TestHTTPResource("echo")
@TestHTTPResource("api/echo")
URI echoUri;

@RegisterExtension
Expand All @@ -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");
}
});

Expand Down

0 comments on commit 560ad1c

Please sign in to comment.