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.
相关问题
- TestNG report with customized error in place of st
- TESTNG: how to send emailable report as an email
- org.testng.TestNGException: sun.security.provider.
- Combining 2 reports into one 1 in (testng) allure
- Debugging TestNG configuration failures
相关文章
- TestNG skipping tests - why?
- How to test a Validator which implements Constrain
- Is it safe to use DateTimeUtils.setCurrentMillisFi
- How to use @FindBy annotation in Selenium WebDrive
- use verify on mocked (with Mockito) objects inject
- How to run TestNG suite with failsafe without unpa
- How to install TestNG eclipse plugin offline?
- TetsNG SoftAssert with Hamcrest matcher
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.