01: package test.dependent;
02:
03: /**
04: * This class exercises dependent methods
05: *
06: * @author Cedric Beust, Aug 19, 2004
07: *
08: */
09: public class SampleDependentMethods2 {
10: private boolean m_oneA = false;
11: private boolean m_oneB = false;
12: private boolean m_secondA = false;
13: private boolean m_thirdA = false;
14:
15: /**
16: * @testng.test groups = "one"
17: */
18: public void oneA() {
19: // ppp("oneA");
20: assert !m_secondA : "secondA shouldn't have been run yet";
21: m_oneA = true;
22: }
23:
24: /**
25: * @testng.test
26: */
27: public void canBeRunAnytime() {
28:
29: }
30:
31: /**
32: * @testng.test dependsOnGroups = "one"
33: */
34: public void secondA() {
35: // ppp("secondA");
36: assert m_oneA : "SampleDependentMethods2.oneA wasn't run";
37: assert m_oneB : "SampleDependentMethods2.oneB wasn't run";
38: assert !m_secondA : "secondA shouldn't have been run yet";
39: m_secondA = true;
40: }
41:
42: /**
43: * @testng.test dependsOnMethods = "secondA"
44: */
45: public void thirdA() {
46: // ppp("thirdA");
47: assert m_oneA : "SampleDependentMethods2.oneA wasn't run";
48: assert m_oneB : "SampleDependentMethods2.oneB wasn't run";
49: assert m_secondA : "secondA wasn't run";
50: assert !m_thirdA : "thirdA shouldn't have been run yet";
51: m_thirdA = true;
52: }
53:
54: /**
55: * @testng.test groups = "one"
56: */
57: public void oneB() {
58: // ppp("oneB");
59: assert !m_secondA : "secondA shouldn't have been run yet";
60: m_oneB = true;
61: }
62:
63: /**
64: * @testng.after-class
65: */
66: public void tearDown() {
67: assert m_oneA : "SampleDependentMethods2.oneA wasn't run";
68: assert m_oneB : "SampleDependentMethods2.oneB wasn't run";
69: assert m_secondA : "secondA wasn't run";
70: assert m_thirdA : "thirdA wasn't run";
71: }
72:
73: public static void ppp(String s) {
74: System.out.println("[SampleDependentMethods] " + s);
75: }
76: }
|