01: package test;
02:
03: /**
04: * This class
05: *
06: * @author Cedric Beust, May 5, 2004
07: *
08: */
09: public class JUnitTest1 extends BaseTest {
10: /**
11: * @testng.before-method dependsOnGroups="initTest"
12: */
13: public void initJUnitFlag() {
14: getTest().setJUnit(true);
15: }
16:
17: /**
18: * @testng.test
19: */
20: public void methodsThatStartWithTest() {
21: addClass("test.sample.JUnitSample1");
22: assert getTest().isJUnit();
23:
24: run();
25: String[] passed = { "testSample1_1", "testSample1_2" };
26: String[] failed = {};
27:
28: verifyTests("Passed", passed, getPassedTests());
29: verifyTests("Failed", failed, getFailedTests());
30: }
31:
32: /**
33: * @testng.test groups="current"
34: */
35: public void methodsWithSetup() {
36: addClass("test.sample.JUnitSample2");
37: run();
38: String[] passed = { "testSample2ThatSetUpWasRun", };
39: String[] failed = {};
40:
41: verifyTests("Passed", passed, getPassedTests());
42: verifyTests("Failed", failed, getFailedTests());
43: }
44:
45: /**
46: * @testng.test
47: */
48: public void testSuite() {
49: addClass("test.sample.AllJUnitTests");
50: run();
51: String[] passed = { "testSample1_1",
52: "testSample2ThatSetUpWasRun", };
53: String[] failed = {};
54:
55: verifyTests("Passed", passed, getPassedTests());
56: verifyTests("Failed", failed, getFailedTests());
57: }
58:
59: public static void ppp(String s) {
60: System.out.println("[JUnitTest1] " + s);
61: }
62:
63: }
|