01: package test.regression.groupsordering;
02:
03: import org.testng.Assert;
04: import org.testng.annotations.AfterGroups;
05: import org.testng.annotations.BeforeGroups;
06: import org.testng.annotations.Test;
07:
08: public abstract class Base {
09: protected static boolean s_childAWasRun;
10: protected static boolean s_childBWasRun;
11:
12: @BeforeGroups(value="a",groups="a")
13: public void setUp() throws Exception {
14: // System.out.println("class is " + getClass().getName() + " Before group ");
15: Assert
16: .assertFalse(s_childBWasRun || s_childBWasRun,
17: "Static field was not reset: @AfterGroup method not invoked");
18: }
19:
20: @AfterGroups(value="a",groups="a")
21: public void tearDown() {
22: // System.out.println("class is " + getClass().getName() + " After group ");
23: Assert.assertTrue(s_childAWasRun, "Child A was not run");
24: Assert.assertTrue(s_childBWasRun, "Child B was not run");
25: s_childAWasRun = false;
26: s_childBWasRun = false;
27: }
28:
29: }
|