Home | History | Annotate | Download | only in timeout
      1 package test.timeout;
      2 
      3 import org.testng.annotations.Test;
      4 
      5 /**
      6  * This class tests timeouts
      7  *
      8  * @author cbeust
      9  */
     10 public class TimeOutSampleTest {
     11 
     12   @Test(timeOut = 5_000 /* 5 seconds */)
     13   public void timeoutShouldPass() {
     14   }
     15 
     16   @Test(timeOut = 5_000 /* 5 seconds */)
     17   public void timeoutShouldFailByException() {
     18     throw new RuntimeException("EXCEPTION SHOULD MAKE THIS METHOD FAIL");
     19   }
     20 
     21   @Test(timeOut = 1_000 /* 1 second */)
     22   public void timeoutShouldFailByTimeOut() throws InterruptedException {
     23       Thread.sleep(10_000 /* 10 seconds */);
     24   }
     25 }
     26