Skip to content

Commit

Permalink
Log exceptions thrown when executing debug of FW tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michalvavrik committed Oct 19, 2023
1 parent c4d9f9a commit 735ff94
Showing 1 changed file with 28 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,37 @@ public Iterable<Class<?>> getSuites() {

@Override
public RunResult invoke(Object o) throws TestSetFailedException, ReporterException, InvocationTargetException {
var bootstrap = new QuarkusScenarioBootstrap();
var testContext = new TestContext.TestContextImpl(findTestClass(), Set.of());
var testClassInstance = instantiateTestClass();

bootstrap.beforeAll(testContext);
invokeTestBeforeAll(testClassInstance);
if (runTests) {
// beforeEach methods are called before test
runTests(testClassInstance, bootstrap, testContext);
} else {
invokeTestBeforeEach(testClassInstance);
bootstrap.beforeEach(testContext, findTestMethod());
}
try {
var bootstrap = new QuarkusScenarioBootstrap();
var testContext = new TestContext.TestContextImpl(findTestClass(), Set.of());
var testClassInstance = instantiateTestClass();

bootstrap.beforeAll(testContext);
invokeTestBeforeAll(testClassInstance);
if (runTests) {
// beforeEach methods are called before test
runTests(testClassInstance, bootstrap, testContext);
} else {
invokeTestBeforeEach(testClassInstance);
bootstrap.beforeEach(testContext, findTestMethod());
}

waitTillUserWishesToExit();
waitTillUserWishesToExit();

if (!runTests) {
bootstrap.afterEach();
invokeTestAfterEach(testClassInstance);
if (!runTests) {
bootstrap.afterEach();
invokeTestAfterEach(testClassInstance);
}
invokeTestAfterAll(testClassInstance);
bootstrap.afterAll();

return noTestsRun();
} catch (Throwable t) {
// this needs to be done, because the exception and message are not logged,
// instead, generic exception is provided
LOG.error("Execution failed with following exception", t);
throw t;
}
invokeTestAfterAll(testClassInstance);
bootstrap.afterAll();

return noTestsRun();
}

private Object instantiateTestClass() throws InvocationTargetException {
Expand Down

0 comments on commit 735ff94

Please sign in to comment.