1 /***
2 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3 */
4 package test.net.sourceforge.pmd.testframework;
5
6 import net.sourceforge.pmd.Rule;
7
8 /***
9 * Standard methods for (simple) testcases.
10 */
11 public class SimpleAggregatorTst extends RuleTst {
12 /***
13 * Run a set of tests defined in an XML test-data file for a rule. The file
14 * should be ./xml/RuleName.xml relative to the test-class. The format is
15 * defined in test-data.xsd.
16 */
17 public void runTests(Rule rule) {
18 runTests(extractTestsFromXml(rule));
19 }
20
21 /***
22 * Run a set of tests defined in a XML test-data file. The file should be
23 * ./xml/[testsFileName].xml relative to the test-class. The format is
24 * defined in test-data.xsd.
25 */
26 public void runTests(Rule rule, String testsFileName) {
27 runTests(extractTestsFromXml(rule, testsFileName));
28 }
29
30 /***
31 * Run a set of tests of a certain sourceType.
32 */
33 public void runTests(TestDescriptor[] tests) {
34 for (int i = 0; i < tests.length; i++) {
35 runTest(tests[i]);
36 }
37 }
38
39 }