1package test.configuration;
2
3import org.testng.Assert;
4import org.testng.annotations.AfterGroups;
5import org.testng.annotations.Test;
6
7/**
8 * Simple afterGroups test
9 *
10 * @author cbeust
11 * @date Mar 7, 2006
12 */
13public class ConfigurationGroups4SampleTest {
14
15  private boolean m_after = false;
16  private boolean m_run = false;
17
18  @Test
19  public void f() {
20    log("f");
21  }
22
23  @Test(groups = "cg4-1")
24  public void run() {
25    log("run");
26    Assert.assertFalse(m_after);
27    m_run = true;
28  }
29
30  @AfterGroups("cg4-1")
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")
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
45  private void log(String string) {
46    ppp(string);
47  }
48
49  private void ppp(String s) {
50    if (false) {
51      System.out.println("[ConfigurationGroups4SampleTest] " + s);
52    }
53  }
54
55}
56