Tuesday, 22 January 2013

TestNG Tutorial 4 – Time Test


import org.testng.annotations.*;
 
/**
 * TestNG TimeOut Test

 *
 */
public class TestNGTest4 {
 
 @Test(timeOut = 1000)  
 public void infinity() {  
  while (true);  
 }  
 
}
In above example, the infinity() method will not return, so the TestNG engine will mark it as failed and throw an exception
FAILED: infinity
org.testng.internal.thread.ThreadTimeoutException: 
Method public void TestNGTest4.infinity() didn't finish within the time-out 1000
... Removed 18 stack frames

No comments:

Post a Comment