01: package test.configuration;
02:
03: import java.util.ArrayList;
04: import java.util.List;
05:
06: import org.testng.annotations.AfterGroups;
07: import org.testng.annotations.BeforeGroups;
08: import org.testng.annotations.DataProvider;
09: import org.testng.annotations.Test;
10:
11: public class ConfigurationGroupBothSampleTest {
12: static List<Integer> m_list = new ArrayList<Integer>();
13:
14: @BeforeGroups(groups={"twice"},value={"twice"})
15: public void a() {
16: ppp("BEFORE()");
17: m_list.add(1);
18: }
19:
20: @Test(groups={"twice"},dataProvider="MyData",invocationCount=2,threadPoolSize=2)
21: public void b(int a, int b) {
22: m_list.add(2);
23: ppp("B()" + a + "," + b);
24: }
25:
26: @AfterGroups(groups={"twice"},value={"twice"})
27: public void c() {
28: m_list.add(3);
29: ppp("AFTER()");
30: }
31:
32: @DataProvider(name="MyData")
33: public Object[][] input() {
34: return new Object[][] { { 1, 1 }, { 2, 2 }, { 3, 3 } };
35: }
36:
37: private void ppp(String string) {
38: if (false) {
39: System.out.println("[A] " + string + " on Thread:"
40: + Thread.currentThread());
41: }
42: }
43:
44: }
|