01: package example;
02:
03: import java.io.File;
04:
05: import junit.extensions.abbot.*;
06: import junit.framework.Test;
07:
08: //import junit.textui.TestRunner;
09: //import junit.ui.TestRunner;
10: //import junit.swingui.TestRunner;
11:
12: /** Simple example of a ScriptTestSuite. Selects all scripts of the form
13: * MyCode-[0-9]*.xml.
14: */
15: public class MyCodeTest extends ScriptFixture {
16:
17: /** Name is the name of a script filename. */
18: public MyCodeTest(String name) {
19: super (name);
20: }
21:
22: /** Return the set of scripts we want to run. */
23: public static Test suite() {
24: return new ScriptTestSuite(MyCodeTest.class, "src/example") {
25: /** Determine whether the given script should be included. */
26: public boolean accept(File file) {
27: String name = file.getName();
28: return name.startsWith("MyCode-")
29: && Character.isDigit(name.charAt(7))
30: && name.endsWith(".xml");
31: }
32: };
33: }
34:
35: public static void main(String[] args) {
36: TestHelper.runTests(args, MyCodeTest.class);
37: }
38: }
|