1 package test.configuration;
2 
3 import org.testng.Assert;
4 import org.testng.annotations.AfterGroups;
5 import org.testng.annotations.Test;
6 
7 /**
8  * Simple afterGroups test
9  *
10  * @author cbeust
11  * @date Mar 7, 2006
12  */
13 public class ConfigurationGroups4SampleTest {
14 
15   private boolean m_after = false;
16   private boolean m_run = false;
17 
18   @Test
f()19   public void f() {
20     log("f");
21   }
22 
23   @Test(groups = "cg4-1")
run()24   public void run() {
25     log("run");
26     Assert.assertFalse(m_after);
27     m_run = true;
28   }
29 
30   @AfterGroups("cg4-1")
after1()31   public void after1() {
32     log("after1");
33     Assert.assertTrue(m_run);
34     Assert.assertFalse(m_after);
35     m_after = true;
36   }
37 
38   @Test(dependsOnGroups = "cg4-1")
verify()39   public void verify() {
40     log("verify");
41     Assert.assertTrue(m_run, "run() wasn't run");
42     Assert.assertTrue(m_after, "after1() wasn't run");
43   }
44 
log(String string)45   private void log(String string) {
46     ppp(string);
47   }
48 
ppp(String s)49   private void ppp(String s) {
50     if (false) {
51       System.out.println("[ConfigurationGroups4SampleTest] " + s);
52     }
53   }
54 
55 }
56