1 package test.groupbug;
2 
3 import org.testng.annotations.AfterClass;
4 import org.testng.annotations.BeforeClass;
5 import org.testng.annotations.Test;
6 
7 public class ITCaseOne {
8 
9   @BeforeClass
beforeClass()10   public void beforeClass() {
11     System.out.printf("RUN %s.beforeClass()\n", getClass());
12   }
13 
14   @AfterClass(alwaysRun = true)
afterClass()15   public void afterClass() {
16     System.out.printf("RUN %s.afterClass()\n", getClass());
17   }
18 
19   @Test(groups = "std-one")
one1()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")
one2()29   public void one2() {
30     GroupBugTest.passed.add("one2");
31     System.out.printf("RUN %s.one2()\n", getClass());
32   }
33 
34 }