01: package test.interleavedorder;
02:
03: import org.testng.Assert;
04: import org.testng.TestListenerAdapter;
05: import org.testng.TestNG;
06:
07: import test.BaseTest;
08: import testhelper.OutputDirectoryPatch;
09:
10: public class InterleavedInvocationTest extends BaseTest {
11: public static final StringBuffer LOG = new StringBuffer();
12:
13: /**
14: * @testng.test
15: */
16: public void invocationOrder() {
17: TestListenerAdapter tla = new TestListenerAdapter();
18: TestNG testng = new TestNG();
19: testng.setTestClasses(new Class[] { TestChild1.class,
20: TestChild2.class });
21: testng.addListener(tla);
22: testng.setVerbose(0);
23: testng.setOutputDirectory(OutputDirectoryPatch
24: .getOutputDirectory());
25: testng.run();
26:
27: final String log = LOG.toString();
28: final String clsName = TestChild1.class.getName();
29:
30: Assert.assertTrue(LOG.indexOf(clsName
31: + ".beforeTestChildOneClass " + clsName + ".testOne "
32: + clsName + ".testTwo " + clsName + ".testThree "
33: + clsName + ".afterTestChildOneClass") > -1);
34: }
35:
36: }
|