You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/04/28 08:44:33 UTC
[camel-spring-boot] branch main updated: Add more failure detail to the UnitTestCommand assertion - itest failures were being swallowed, now providing failure messages and the stack of the last failure (#546)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new d9455c20f82 Add more failure detail to the UnitTestCommand assertion - itest failures were being swallowed, now providing failure messages and the stack of the last failure (#546)
d9455c20f82 is described below
commit d9455c20f824c496b6f32d80028d8916d9b6c973
Author: Tom Cunningham <tc...@redhat.com>
AuthorDate: Thu Apr 28 04:44:27 2022 -0400
Add more failure detail to the UnitTestCommand assertion - itest failures were being swallowed, now providing failure messages and the stack of the last failure (#546)
---
.../camel/itest/springboot/command/UnitTestCommand.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/UnitTestCommand.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/UnitTestCommand.java
index 7f499293ed7..f9e785a9ba6 100644
--- a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/UnitTestCommand.java
+++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/UnitTestCommand.java
@@ -106,16 +106,26 @@ public class UnitTestCommand extends AbstractTestCommand implements Command {
+ " - Failures: " + result.getTestsFailedCount()
+ " - Skipped Tests: " + result.getTestsSkippedCount());
+
+ StringBuilder failureString = new StringBuilder();
+ Throwable failureException = null;
for (Failure f : result.getFailures()) {
+ failureString.append(f.getTestIdentifier().getDisplayName() + " - "
+ + f.getException().getMessage() + "\n");
logger.warn("Failed test description: {}", f.getTestIdentifier());
logger.warn("Message: {}", f.getException().getMessage());
if (f.getException() != null) {
- logger.warn("Exception thrown from test", f.getException());
+ logger.error("Exception thrown from test", f.getException());
+ failureException = f.getException();
}
}
if (!testSucceeded) {
- Assertions.fail("Some unit tests failed (" + result.getTestsFailedCount() + "/" + result.getTestsStartedCount() + "), check the logs for more details");
+ if (failureException != null) {
+ Assertions.fail("Some unit tests failed (" + result.getTestsFailedCount() + "/" + result.getTestsStartedCount() + ") : " + failureString.toString(), failureException);
+ } else {
+ Assertions.fail("Some unit tests failed (" + result.getTestsFailedCount() + "/" + result.getTestsStartedCount() + ") : " + failureString.toString());
+ }
}
if (result.getTestsStartedCount() == 0 && config.getUnitTestsExpectedNumber() == null) {