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