KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jimm > datavision > test > AllTests


1 package jimm.datavision.test;
2 import jimm.util.Getopts;
3 import junit.framework.TestCase;
4 import junit.framework.TestSuite;
5 import junit.framework.Test;
6
7 /**
8  * @author Jim Menard, <a HREF="mailto:jimm@io.com">jimm@io.com</a>
9  */

10 public class AllTests extends TestCase {
11
12 static final String JavaDoc DATA_FILE_DIR = "jimm/datavision/test/data";
13
14 /**
15  * Returns a relative file path to <var>fileName</var>. Assumes the app is
16  * being run from the top-level DataVision directory.
17  *
18  * @param fileName the name of a file in the DATA_FILE_DIR directory
19  * @return a relative file path to <var>fileName</var>
20  */

21 static String JavaDoc testDataFile(String JavaDoc fileName) {
22     return DATA_FILE_DIR + '/' + fileName;
23 }
24
25 public static Test suite(boolean runJdbcTests, boolean skipNonJdbcTests) {
26     TestSuite suite = new TestSuite();
27     if (!skipNonJdbcTests) {
28     suite.addTest(StringUtilsTest.suite());
29     suite.addTest(ColumnIteratorTest.suite());
30     suite.addTest(DelimParserTest.suite());
31     suite.addTest(XMLWriterTest.suite());
32     suite.addTest(FormulaTest.suite());
33     suite.addTest(FormulaEvalTest.suite());
34     suite.addTest(SectionAreaTest.suite());
35     suite.addTest(SuppressionProcTest.suite());
36     suite.addTest(GroupFormulaTest.suite());
37     suite.addTest(GetoptsTest.suite());
38     suite.addTest(ParserHelperTest.suite());
39     suite.addTest(PDFLETest.suite());
40     suite.addTest(ReportTest.suite());
41     suite.addTest(ReportRunTest.suite());
42     suite.addTest(ScriptingTest.suite());
43     suite.addTest(CharSepTest.suite());
44     suite.addTest(AggregateTest.suite());
45     }
46     if (runJdbcTests) {
47     suite.addTest(SubreportRunTest.suite());
48     suite.addTest(ConnectionTest.suite());
49     suite.addTest(QueryTest.suite());
50     }
51     return suite;
52 }
53
54 public AllTests(String JavaDoc name) {
55     super(name);
56 }
57
58 public void testDummy() {
59     assertTrue(true);
60 }
61
62 public static void main(String JavaDoc[] args) {
63     Getopts g = new Getopts("gjJ", args);
64     if (g.error()) {
65     System.err.println("usage: AllTests [-g] [-j] [-J]");
66     System.err.println(" -g Use GUI test runner (ignores -j and -J flags)");
67     System.err.println(" -j Run tests that rely upon JDBC and the database");
68     System.err.println(" -J Skip non-JDBC tests");
69     System.exit(0);
70     }
71
72     if (g.hasOption('g'))
73     junit.swingui.TestRunner.run(AllTests.class);
74     else {
75     junit.textui.TestRunner.run(suite(g.hasOption('j'), g.hasOption('J')));
76     System.exit(0); // For some reason, need this under OS X 10.3
77
}
78 }
79
80 }
81
Popular Tags