01: package test.sample;
02:
03: public class Basic2 {
04: private boolean m_basic2WasRun = false;
05: private static int m_afterClass = 0;
06:
07: /**
08: * @testng.before-suite
09: */
10: public void init() {
11: m_afterClass = 0;
12: m_basic2WasRun = false;
13: }
14:
15: /**
16: * @testng.test dependsOnGroups="basic1"
17: */
18: public void basic2() {
19: m_basic2WasRun = true;
20: assert Basic1.getCount() > 0 : "COUNT WAS NOT INCREMENTED";
21: }
22:
23: private void ppp(String s) {
24: System.out.println("[Basic2 "
25: + Thread.currentThread().hashCode() + " ] "
26: + hashCode() + " " + s);
27: }
28:
29: /**
30: * @testng.after-class
31: */
32: public void checkTestAtClassLevelWasRun() {
33: m_afterClass++;
34: assert m_basic2WasRun : "Class annotated with @Test didn't have its methods run.";
35: assert 1 == m_afterClass : "After class should have been called exactly once, not "
36: + m_afterClass;
37: }
38: }
|