01: package test.sample;
02:
03: /**
04: * Check to see that AfterClass is called only at the end and that after methods
05: * are called in reverse order of the before methods.
06: */
07: public class AfterClassCalledAtEnd extends BaseAfterClassCalledAtEnd {
08: boolean m_before1Class = false;
09: boolean m_test1 = false;
10: boolean m_test2 = false;
11: boolean m_test3 = false;
12:
13: /**
14: * @testng.before-class groups="before1Class"
15: */
16: public void before1Class() {
17: m_before1Class = true;
18: }
19:
20: /**
21: * @testng.after-class groups="someGroup"
22: */
23: public void afterClass() {
24: m_afterClass = true;
25: assert m_test1 && m_test2 && m_test3 : "One of the test methods was not invoked: "
26: + m_test1 + " " + m_test2 + " " + m_test3;
27: }
28:
29: /**
30: * @testng.test
31: */
32: public void test1() {
33: m_test1 = true;
34: assert m_before1Class : "beforeClass configuration must be called before method";
35: assert !m_afterClass : "afterClass configuration must not be called before test method";
36: }
37:
38: /**
39: * @testng.test
40: */
41: public void test2() {
42: m_test2 = true;
43: assert m_before1Class : "beforeClass configuration must be called before method";
44: assert !m_afterClass : "afterClass configuration must not be called before test method";
45: }
46:
47: /**
48: * @testng.test
49: */
50: public void test3() {
51: m_test3 = true;
52: assert m_before1Class : "beforeClass configuration must be called before method";
53: assert !m_afterClass : "afterClass configuration must not be called before test method";
54: }
55:
56: }
|