Home | History | Annotate | Download | only in configuration
      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"})
     14   public void a(){
     15     ppp("BEFORE()");
     16     m_list.add(1);
     17   }
     18 
     19   @Test(groups = {"twice"}, invocationCount = 3)
     20   public void b() {
     21     m_list.add(2);
     22     ppp("B()");
     23   }
     24 
     25   @AfterGroups(groups={"twice"}, value={"twice"})
     26   public void c(){
     27     m_list.add(3);
     28     ppp("AFTER()");
     29   }
     30 
     31   private void ppp(String string) {
     32     if (false) {
     33       System.out.println("[A] " + string);
     34     }
     35   }
     36 
     37 
     38 }
     39