01: package test;
02:
03: public class MethodTest extends BaseTest {
04: private static final String CLASS_NAME = "test.sample.Sample2";
05:
06: /**
07: * @testng.test groups="current"
08: */
09: public void includeMethodsOnly() {
10: addClass(CLASS_NAME);
11: assert 1 == getTest().getXmlClasses().size();
12: addIncludedMethod(CLASS_NAME, ".*method2");
13: run();
14: String[] passed = { "method2", };
15: String[] failed = {};
16: verifyTests("Passed", passed, getPassedTests());
17: verifyTests("Failed", failed, getFailedTests());
18: }
19:
20: /**
21: * @testng.test groups="current"
22: */
23: public void excludeMethodsOnly() {
24: addClass(CLASS_NAME);
25: assert 1 == getTest().getXmlClasses().size();
26: addExcludedMethod(CLASS_NAME, ".*method2");
27: run();
28: String[] passed = { "method1", "method3" };
29: String[] failed = {};
30: verifyTests("Passed", passed, getPassedTests());
31: verifyTests("Failed", failed, getFailedTests());
32: }
33:
34: /**
35: * @testng.test
36: */
37: public void excludePackage() {
38: addClass(CLASS_NAME);
39: assert 1 == getTest().getXmlClasses().size();
40: addExcludedMethod(CLASS_NAME, ".*");
41: run();
42: String[] passed = {};
43: String[] failed = {};
44: verifyTests("Passed", passed, getPassedTests());
45: verifyTests("Failed", failed, getFailedTests());
46: }
47: }
|