01: package jimm.datavision.test;
02:
03: import jimm.util.Getopts;
04: import junit.framework.TestCase;
05: import junit.framework.TestSuite;
06: import junit.framework.Test;
07:
08: /**
09: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
10: */
11: public class AllTests extends TestCase {
12:
13: static final String DATA_FILE_DIR = "jimm/datavision/test/data";
14:
15: /**
16: * Returns a relative file path to <var>fileName</var>. Assumes the app is
17: * being run from the top-level DataVision directory.
18: *
19: * @param fileName the name of a file in the DATA_FILE_DIR directory
20: * @return a relative file path to <var>fileName</var>
21: */
22: static String testDataFile(String fileName) {
23: return DATA_FILE_DIR + '/' + fileName;
24: }
25:
26: public static Test suite(boolean runJdbcTests,
27: boolean skipNonJdbcTests) {
28: TestSuite suite = new TestSuite();
29: if (!skipNonJdbcTests) {
30: suite.addTest(StringUtilsTest.suite());
31: suite.addTest(ColumnIteratorTest.suite());
32: suite.addTest(DelimParserTest.suite());
33: suite.addTest(XMLWriterTest.suite());
34: suite.addTest(FormulaTest.suite());
35: suite.addTest(FormulaEvalTest.suite());
36: suite.addTest(SectionAreaTest.suite());
37: suite.addTest(SuppressionProcTest.suite());
38: suite.addTest(GroupFormulaTest.suite());
39: suite.addTest(GetoptsTest.suite());
40: suite.addTest(ParserHelperTest.suite());
41: suite.addTest(PDFLETest.suite());
42: suite.addTest(ReportTest.suite());
43: suite.addTest(ReportRunTest.suite());
44: suite.addTest(ScriptingTest.suite());
45: suite.addTest(CharSepTest.suite());
46: suite.addTest(AggregateTest.suite());
47: }
48: if (runJdbcTests) {
49: suite.addTest(SubreportRunTest.suite());
50: suite.addTest(ConnectionTest.suite());
51: suite.addTest(QueryTest.suite());
52: }
53: return suite;
54: }
55:
56: public AllTests(String name) {
57: super (name);
58: }
59:
60: public void testDummy() {
61: assertTrue(true);
62: }
63:
64: public static void main(String[] args) {
65: Getopts g = new Getopts("gjJ", args);
66: if (g.error()) {
67: System.err.println("usage: AllTests [-g] [-j] [-J]");
68: System.err
69: .println(" -g Use GUI test runner (ignores -j and -J flags)");
70: System.err
71: .println(" -j Run tests that rely upon JDBC and the database");
72: System.err.println(" -J Skip non-JDBC tests");
73: System.exit(0);
74: }
75:
76: if (g.hasOption('g'))
77: junit.swingui.TestRunner.run(AllTests.class);
78: else {
79: junit.textui.TestRunner.run(suite(g.hasOption('j'), g
80: .hasOption('J')));
81: System.exit(0); // For some reason, need this under OS X 10.3
82: }
83: }
84:
85: }
|