What do you mean by timeOut in TestNG?


The timeOut is a helper attribute in TestNG that can put an end to the execution of a test method if that method takes time beyond the timeOut duration. A timeOut time is set in milliseconds, after that the test method will be marked Failed.

Example

@Test
public void ContactVerify(){
   System.out.println("Contact validation is successful”);
}
@Test(timeOut = 1000)
public void LandingPage(){
   System.out.println("Landing page verification is successful”);
}
@Test
public void LoanContact(){
   System.out.println("Loan contact details verification is successful”);
}

After 1000ms, if LandingPage() execution continues , that test method will be considered as failed. The rest of the test methods will have no impact.

Updated on: 11-Jun-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements