1 package test.configuration; 2 3 import org.testng.annotations.AfterGroups; 4 import org.testng.annotations.BeforeGroups; 5 import org.testng.annotations.Test; 6 7 import java.util.ArrayList; 8 import java.util.List; 9 10 public class ConfigurationGroupInvocationCountSampleTest { 11 static List<Integer> m_list = new ArrayList<>(); 12 13 @BeforeGroups(groups={"twice"}, value={"twice"}) a()14 public void a(){ 15 ppp("BEFORE()"); 16 m_list.add(1); 17 } 18 19 @Test(groups = {"twice"}, invocationCount = 3) b()20 public void b() { 21 m_list.add(2); 22 ppp("B()"); 23 } 24 25 @AfterGroups(groups={"twice"}, value={"twice"}) c()26 public void c(){ 27 m_list.add(3); 28 ppp("AFTER()"); 29 } 30 ppp(String string)31 private void ppp(String string) { 32 if (false) { 33 System.out.println("[A] " + string); 34 } 35 } 36 37 38 } 39