1package test.configuration;
2
3import org.testng.Assert;
4import org.testng.TestListenerAdapter;
5import org.testng.TestNG;
6import org.testng.annotations.Test;
7
8/**
9 * Verify that a base class with a BeforeGroups method only gets invoked
10 * once, no matter how many subclasses it has
11 *
12 * Created on Jan 23, 2007
13 * @author <a href="mailto:cedric@beust.com">Cedric Beust</a>
14 */
15public class BaseGroupsTest {
16
17    @Test
18    public void verifySingleInvocation() {
19      TestNG tng = new TestNG();
20      tng.setVerbose(0);
21      tng.setTestClasses(new Class[] {
22          BaseGroupsASampleTest.class,
23          BaseGroupsBSampleTest.class,
24      });
25      TestListenerAdapter tla = new TestListenerAdapter();
26      tng.addListener(tla);
27
28      tng.run();
29
30      Assert.assertEquals(Base.m_count, 1);
31    }
32
33    private static void ppp(String s) {
34      System.out.println("[BaseGroupsTest] " + s);
35    }
36}
37