01: package test.configuration;
02:
03: import java.util.ArrayList;
04: import java.util.Arrays;
05: import java.util.List;
06:
07: import org.testng.Assert;
08: import org.testng.annotations.AfterGroups;
09: import org.testng.annotations.BeforeGroups;
10: import org.testng.annotations.Test;
11:
12: public class ConfigurationGroups7SampleTest {
13: private List<String> m_log = new ArrayList<String>();
14:
15: @BeforeGroups({"A"})
16: private void initA() {
17: m_log.add("1");
18: }
19:
20: @Test(groups={"A"})
21: public void testSomething() {
22: m_log.add("2");
23: }
24:
25: @Test(groups={"A"})
26: public void testSomethingMore() {
27: m_log.add("2");
28: }
29:
30: @AfterGroups({"A"})
31: private void cleanUpA() {
32: m_log.add("3");
33: }
34:
35: @Test(dependsOnGroups="A")
36: public void verify() {
37: Assert.assertEquals(Arrays.asList(new String[] { "1", "2", "2",
38: "3" }), m_log);
39: }
40:
41: }
|