1 package test.dependent; 2 3 import org.testng.annotations.Test; 4 5 import java.util.ArrayList; 6 import java.util.List; 7 8 public class SD2 { 9 public static List<String> m_log = new ArrayList<>(); 10 11 @Test(groups = { "one" }) oneA()12 public void oneA() { 13 m_log.add("oneA"); 14 } 15 16 @Test canBeRunAnytime()17 public void canBeRunAnytime() { 18 m_log.add("canBeRunAnytime"); 19 } 20 21 @Test(dependsOnGroups = { "one" } ) secondA()22 public void secondA() { 23 m_log.add("secondA"); 24 } 25 26 @Test(dependsOnMethods= { "secondA" }) thirdA()27 public void thirdA() { 28 m_log.add("thirdA"); 29 } 30 31 @Test(groups = { "one" }) oneB()32 public void oneB() { 33 m_log.add("oneB"); 34 } 35 36 }