Reputation: 191
Is it possible to change the status of a test result from @AfterClass method. My requirement is to run some UI tests using @test tag and I need to validate the DB for all those tests in the @AfterClass method, since the DB is taking a while to get updated.
Upvotes: 1
Views: 1710
Reputation: 8531
You cannot do it in AfterClass, but you can utilize a listener to do this. Try out IInvokedMethodListener. Implement the following method : public void afterInvocation(IInvokedMethod method, ITestResult testResult)
The result object can be set here to whatever value, based on some checks (testResult.setStatus(status)
). Note this would be executed after every method.
Upvotes: 1