Skip to content

Commit

Permalink
fix: propagates exception from running runner.run() method (#184)
Browse files Browse the repository at this point in the history
If someone omits required runtime class in a deployment archive there will be ClassDefNotFoundError when executing run() method in TestNGRunner. Arquillian servlet will return HTTP code 500 which is ignored in servlet protocol runner and consequently returned as a test which passed. But in reality the test did not even run and should be marked as failed.
  • Loading branch information
mpiotrowski-im authored and bartoszmajsak committed Oct 17, 2018
1 parent 8218103 commit b95a66e
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ public TestResult execute(Class<?> testClass, String methodName) {
runner.setXmlSuites(
Collections.singletonList(createSuite(testClass, methodName)));

runner.run();
//we catch problems in executing run method, e.g. ClassDefNotFoundError and wrap it in TestResult
try {
runner.run();
} catch (Throwable ex) {
return TestResult.failed(ex);
}

return resultListener.getTestResult();
}
Expand Down

0 comments on commit b95a66e

Please sign in to comment.