01: package junit.extensions.abbot;
02:
03: import junit.framework.*;
04: import java.util.*;
05: import java.io.File;
06: import abbot.util.PathClassLoader;
07:
08: public class ScriptTestCollectorTest extends TestCase {
09:
10: public void testListClasses() {
11: String[] required = { "build/abbot.jar", "build/example.jar", };
12: String path = "";
13: String PS = "";
14: for (int i = 0; i < required.length; i++) {
15: assertTrue("Missing file: " + required[i], new File(
16: required[i]).exists());
17: path += PS + required[i];
18: PS = System.getProperty("path.separator");
19: }
20: ScriptTestCollector tc = new ScriptTestCollector(
21: new PathClassLoader(path));
22: ArrayList list = new ArrayList();
23: Enumeration en = tc.collectTests();
24: while (en.hasMoreElements()) {
25: list.add(en.nextElement());
26: }
27: assertTrue("Some tests should have been found", list.size() > 0);
28: assertFalse("Should ignore framework classes", list
29: .contains("junit.extensions.abbot.ScriptFixture"));
30: }
31:
32: public static void main(String[] args) {
33: TestHelper.runTests(args, ScriptTestCollectorTest.class);
34: }
35: }
|