This question was asked in an interview. Lets say there is a class with 4 test methods, with priorities given properly. While running the test cases, 3rd test case is getting failed. So, how to make sure that the 4th Test case has been run?
To make sure that the 4th Test case is always executed you have to set the alwaysRun
argument to true
along with the TestNG annotation
as follows:
@Test(priority=4)(alwaysRun=true)
void pkg3()
{
System.out.println("pkg3");
}
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.