01: package test.dependent;
02:
03: import org.testng.Assert;
04: import org.testng.annotations.AfterClass;
05: import org.testng.annotations.BeforeClass;
06: import org.testng.annotations.Test;
07:
08: public class ImplicitGroupInclusion2SampleTest {
09: private boolean m_m1, m_m2, m_m3;
10:
11: @BeforeClass(groups={"g2"})
12: public void init() {
13: m_m1 = m_m2 = m_m3 = false;
14: }
15:
16: @Test(groups={"g1"})
17: public void m1() {
18: m_m1 = true;
19: }
20:
21: @Test(groups={"g1"},dependsOnMethods="m1")
22: public void m2() {
23: m_m2 = true;
24: }
25:
26: @Test(groups={"g2"})
27: public void m3() {
28: m_m3 = true;
29: }
30:
31: @AfterClass(groups={"g2"})
32: public void verify() {
33: Assert.assertFalse(m_m1, "Shouldn't have invoked m1()");
34: Assert.assertFalse(m_m2);
35: Assert.assertTrue(m_m3);
36: }
37: }
|