While doing automation using TestNG,we have a lot of methods those are taking more times and due to those methods in between our testing or execution getting stuck.
To overcome this type of issue TestNG have "timeOut "feature.
How Timeout works ?
EX:
@Test(timeOut=3000)
public void timeoutTest() {
system.out.print("hello")
}
Here the method will execute upto 3000 miliseconds to complete execution.Means particular methods will talke maximum 3000 miliseconds.If execution getting failed within this time then it will go to next method.It won't block the execution flow.
We can use time out feature in testNG.xml also
ex:
<suite name="Timeout Suite" time-out="4000" verbose="1">
<test name="Timeout Test" >
<classes>
<class name="demoTest.timeoutTest"/>
</classes>
</test>
</suite>
Here for each methods within this class execution time will be maximum 4000 miliseconds.
To overcome this type of issue TestNG have "timeOut "feature.
How Timeout works ?
EX:
@Test(timeOut=3000)
public void timeoutTest() {
system.out.print("hello")
}
Here the method will execute upto 3000 miliseconds to complete execution.Means particular methods will talke maximum 3000 miliseconds.If execution getting failed within this time then it will go to next method.It won't block the execution flow.
We can use time out feature in testNG.xml also
ex:
<suite name="Timeout Suite" time-out="4000" verbose="1">
<test name="Timeout Test" >
<classes>
<class name="demoTest.timeoutTest"/>
</classes>
</test>
</suite>
Here for each methods within this class execution time will be maximum 4000 miliseconds.