I am working on Page Object Model framework in the Selenium -TestNG using Java in Eclipse IDE. I have my base class, pages and test classes ready. In my test, I am using SoftAssert class as I want my test to continue even when they fail. In the end I do SoftAssert.assertAll().
Everything works fine.
But ideally where should assertAll method be executed?
As per ur comment @AfterTest? what you meant by @AfterTest?
@BeforeTest and @AfterTest are respective to test (<test>... </test>)
in testng.xml file
simply use SoftAssert softAssertion= new SoftAssert(); at start of @Test and softAssertion.assertAll(); at end
@Test
public void softAssert(){
SoftAssert softAssertion= new SoftAssert();
//..............
//..............
softAssertion.assertAll();
}
go through doc to learn more on testng https://testng.org/doc/documentation-main.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.