01: package test.timeout;
02:
03: import org.testng.annotations.*;
04:
05: /**
06: * This class tests timeouts
07: *
08: * @author cbeust
09: */
10: public class TimeOutSampleTest {
11:
12: @Test(timeOut=5000)
13: public void timeoutShouldPass() {
14: }
15:
16: @Test(timeOut=5 * 1000)
17: public void timeoutShouldFailByException() {
18: throw new RuntimeException(
19: "EXCEPTION SHOULD MAKE THIS METHOD FAIL");
20: }
21:
22: @Test(timeOut=1000)
23: public void timeoutShouldFailByTimeOut()
24: throws InterruptedException {
25: Thread.sleep(10 * 1000 /* 10 seconds */);
26: }
27:
28: public static void ppp(String s) {
29: System.out.println("[TimeOutTest]@@@@@@@@@@@@@@@ " + s);
30: }
31: }
|