01: package test.configuration;
02:
03: import org.testng.Assert;
04:
05: public class ExternalConfigurationClass {
06: public static boolean s_afterMethod;
07: public static boolean s_afterClass;
08: public static boolean s_afterTest;
09:
10: /**
11: * @testng.before-suite
12: */
13: public void beforeSuite() {
14: MethodCallOrderTest.s_beforeSuite = true;
15: }
16:
17: /**
18: * @testng.before-method
19: */
20: public void beforeTest() {
21: Assert.assertTrue(MethodCallOrderTest.s_beforeSuite);
22: Assert.assertTrue(!MethodCallOrderTest.s_beforeTest);
23: Assert.assertTrue(!MethodCallOrderTest.s_beforeClass);
24: Assert.assertTrue(!MethodCallOrderTest.s_beforeMethod);
25:
26: MethodCallOrderTest.s_beforeTest = true;
27: }
28:
29: /**
30: * @testng.after-test
31: */
32: public void afterTest() {
33: Assert.assertTrue(s_afterMethod,
34: "afterTestMethod should have been run");
35: Assert.assertTrue(s_afterClass,
36: "afterTestClass should have been run");
37: Assert.assertTrue(!s_afterTest,
38: "afterTest should haven't been run");
39: s_afterTest = true;
40: }
41:
42: /**
43: * @testng.after-suite
44: */
45: public void afterSuite() {
46: Assert.assertTrue(s_afterMethod,
47: "afterTestMethod should have been run");
48: Assert.assertTrue(s_afterClass,
49: "afterTestClass should have been run");
50: Assert
51: .assertTrue(s_afterTest,
52: "afterTest should have been run");
53:
54: // clean up for the next run
55: s_afterMethod = false;
56: s_afterClass = false;
57: s_afterTest = false;
58:
59: }
60: }
|