01: package test.sample;
02:
03: /**
04: * This class tests timeouts
05: *
06: * @author cbeust
07: */
08: public class TimeOutTest {
09: /**
10: * @testng.test timeOut="5000"
11: */
12: public void timeoutShouldPass() {
13: }
14:
15: /**
16: * @testng.test timeOut="5000"
17: */
18: public void timeoutShouldFail1() {
19: throw new RuntimeException(
20: "EXCEPTION SHOULD MAKE THIS METHOD FAIL");
21: }
22:
23: /**
24: * @throws InterruptedException
25: * @testng.test timeOut="1000"
26: */
27: public void timeoutShouldFail2() throws InterruptedException {
28: Thread.sleep(5 * 1000);
29: throw new RuntimeException(
30: "SHOULD HAVE BEEN INTERRUPTED BY TESTNG");
31: }
32:
33: private static void ppp(String s) {
34: System.out.println("[TimeOutTest] " + s);
35: }
36: }
|