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