01: package test.methodselectors;
02:
03: import org.testng.annotations.Test;
04:
05: import test.BaseTest;
06:
07: public class MethodSelectorTest extends BaseTest {
08:
09: @Test
10: public void negativePriorityAllGroups() {
11: addClass("test.methodselectors.SampleTest");
12: addMethodSelector(
13: "test.methodselectors.AllTestsMethodSelector", -1);
14: run();
15: String[] passed = { "test1", "test2", "test3", };
16: String[] failed = {};
17: verifyTests("Passed", passed, getPassedTests());
18: verifyTests("Failed", failed, getFailedTests());
19: }
20:
21: @Test
22: public void negativePriorityGroup2() {
23: addClass("test.methodselectors.SampleTest");
24: addMethodSelector("test.methodselectors.Test2MethodSelector",
25: -1);
26: run();
27: String[] passed = { "test2", };
28: String[] failed = {};
29: verifyTests("Passed", passed, getPassedTests());
30: verifyTests("Failed", failed, getFailedTests());
31: }
32:
33: @Test
34: public void lessThanPriorityTest1Test() {
35: addClass("test.methodselectors.SampleTest");
36: addIncludedGroup("test1");
37: addMethodSelector("test.methodselectors.Test2MethodSelector", 5);
38: run();
39: String[] passed = { "test1", "test2", };
40: String[] failed = {};
41: verifyTests("Passed", passed, getPassedTests());
42: verifyTests("Failed", failed, getFailedTests());
43: }
44:
45: @Test
46: public void greaterThanPriorityTest1Test2() {
47: addClass("test.methodselectors.SampleTest");
48: addIncludedGroup("test1");
49: addMethodSelector("test.methodselectors.Test2MethodSelector",
50: 15);
51: run();
52: String[] passed = { "test2", };
53: String[] failed = {};
54: verifyTests("Passed", passed, getPassedTests());
55: verifyTests("Failed", failed, getFailedTests());
56: }
57:
58: @Test
59: public void lessThanPriorityAllTests() {
60: addClass("test.methodselectors.SampleTest");
61: addIncludedGroup("test1");
62: addMethodSelector(
63: "test.methodselectors.AllTestsMethodSelector", 5);
64: run();
65: String[] passed = { "test1", "test2", "test3" };
66: String[] failed = {};
67: verifyTests("Passed", passed, getPassedTests());
68: verifyTests("Failed", failed, getFailedTests());
69: }
70:
71: public static void ppp(String s) {
72: System.out.println("[MethodSelectorTest] " + s);
73: }
74: }
|