01: package test.configuration;
02:
03: import java.util.Arrays;
04: import java.util.List;
05:
06: import org.testng.Assert;
07: import org.testng.TestNG;
08: import org.testng.annotations.BeforeMethod;
09: import org.testng.annotations.Test;
10:
11: public class GroupsTest {
12:
13: private TestNG m_testNg;
14:
15: @BeforeMethod
16: public void setUp() {
17: m_testNg = new TestNG();
18: m_testNg.setVerbose(0);
19: }
20:
21: @Test
22: public void verifyDataProviderAfterGroups() {
23: runTest(ConfigurationGroupDataProviderSampleTest.class,
24: ConfigurationGroupDataProviderSampleTest.m_list, Arrays
25: .asList(new Integer[] { 1, 2, 2, 2, 3 }));
26: }
27:
28: @Test
29: public void verifyParametersAfterGroups() {
30: runTest(ConfigurationGroupInvocationCountSampleTest.class,
31: ConfigurationGroupInvocationCountSampleTest.m_list,
32: Arrays.asList(new Integer[] { 1, 2, 2, 2, 3 }));
33: }
34:
35: @Test
36: public void verifyBothAfterGroups() {
37: runTest(ConfigurationGroupBothSampleTest.class,
38: ConfigurationGroupBothSampleTest.m_list,
39: Arrays.asList(new Integer[] { 1, 2, 2, 2, 2, 2, 2, 3 }));
40: }
41:
42: private void runTest(Class cls, List<Integer> list,
43: List<Integer> expected) {
44: m_testNg.setTestClasses(new Class[] { cls });
45: m_testNg.run();
46:
47: Assert.assertEquals(list, expected);
48: }
49: }
|