1package test.groupbug; 2 3import org.testng.annotations.AfterClass; 4import org.testng.annotations.BeforeClass; 5import org.testng.annotations.Test; 6 7public class ITCaseOne { 8 9 @BeforeClass 10 public void beforeClass() { 11 System.out.printf("RUN %s.beforeClass()\n", getClass()); 12 } 13 14 @AfterClass(alwaysRun = true) 15 public void afterClass() { 16 System.out.printf("RUN %s.afterClass()\n", getClass()); 17 } 18 19 @Test(groups = "std-one") 20 public void one1() { 21 GroupBugTest.passed.add("one1"); 22 System.out.printf("RUN %s.one1()\n", getClass()); 23 } 24 25 /** 26 * Commenting out dependsOnGroups fixes the ordering, that's the bug. 27 */ 28 @Test(groups = "logic-one", dependsOnGroups = "std-one") 29 public void one2() { 30 GroupBugTest.passed.add("one2"); 31 System.out.printf("RUN %s.one2()\n", getClass()); 32 } 33 34}