01: package test.timeout;
02:
03: import org.testng.annotations.Test;
04: import org.testng.xml.XmlSuite;
05:
06: import test.BaseTest;
07:
08: /**
09: * This class
10: *
11: * @author cbeust
12: */
13: public class TimeOutTest extends BaseTest {
14: private Long m_id;
15:
16: public TimeOutTest() {
17: m_id = new Long(System.currentTimeMillis());
18: }
19:
20: @Test
21: public void timeOutInParallel() {
22: addClass("test.timeout.TimeOutSampleTest");
23: setParallel(XmlSuite.PARALLEL_METHODS);
24: run();
25: String[] passed = { "timeoutShouldPass", };
26: String[] failed = { "timeoutShouldFailByException",
27: "timeoutShouldFailByTimeOut" };
28:
29: // dumpResults("Passed", getPassedTests());
30:
31: verifyTests("Passed", passed, getPassedTests());
32: verifyTests("Failed", failed, getFailedTests());
33: }
34:
35: @Test
36: public void timeOutInNonParallel() {
37: addClass("test.timeout.TimeOutSampleTest");
38: run();
39: String[] passed = { "timeoutShouldPass", };
40: String[] failed = { "timeoutShouldFailByException",
41: "timeoutShouldFailByTimeOut" };
42: verifyTests("Passed", passed, getPassedTests());
43: verifyTests("Failed", failed, getFailedTests());
44: }
45:
46: public Long getId() {
47: return m_id;
48: }
49:
50: }
|