-
Bug
-
Resolution: Done
-
Major
-
1.0.3.Final
-
None
When a test fails, the state of TestResult is still PASSED and therefore it can't be used in observer:
public class LifecycleObserver { @Inject private Instance<TestResult> result; public void afterTest(@Observes After event) { if (result.get().getStatus().equals(PASSED)) { // something } else { // something else } } }
The problem is LocalTestExecutor updates the status to FAILED only if an exception is thrown, but TestMethodExecutor from TestNG implemenation doesn't throw any exception when the test fails. It memorizes it in ITestResult object.
I propose to throw an exception in the end of test invocation, if the test fails.