01: package test.configuration;
02:
03: import org.testng.Assert;
04: import org.testng.TestListenerAdapter;
05: import org.testng.TestNG;
06: import org.testng.annotations.Test;
07:
08: /**
09: * 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: */
15: public class BaseGroupsTest {
16:
17: @Test
18: public void verifySingleInvocation() {
19: TestNG tng = new TestNG();
20: tng.setVerbose(0);
21: tng.setTestClasses(new Class[] { BaseGroupsASampleTest.class,
22: BaseGroupsBSampleTest.class, });
23: TestListenerAdapter tla = new TestListenerAdapter();
24: tng.addListener(tla);
25:
26: tng.run();
27:
28: Assert.assertEquals(Base.m_count, 1);
29: }
30:
31: private static void ppp(String s) {
32: System.out.println("[BaseGroupsTest] " + s);
33: }
34: }
|