Source code: com/simscomputing/testbed/Main.java
1 package com.simscomputing.testbed;
2
3 import java.io.File;
4
5 /**
6 A simple command line interface for exercising TestCaseCollections.
7 The functionality mirrors the functionality of the GUI.
8
9 @author David Sims
10 @version $Revision: 1.1.1.1 $ $Date: 2000/02/21 21:22:33 $
11 */
12 public class Main {
13 public static void main(final String[] args) {
14 if (args.length != 1 && args.length != 2) {
15 System.out.println("usage: Main <path to class file>");
16 System.out.println(" Main -d <path to directory of TestCaseCollections>");
17 System.out.println(" Main -r <path to recursive directory of TestCaseCollections>");
18 return;
19 } // if
20
21 try {
22 TestResultCollection results;
23
24 if (args[0].equals("-d")) {
25 final DirectoryTester directoryTester = new DirectoryTester(new File(args[1]),
26 false);
27 results = directoryTester.exercise(true, null);
28 } // if
29 else if (args[0].equals("-r")) {
30 final DirectoryTester directoryTester = new DirectoryTester(new File(args[1]),
31 true);
32 results = directoryTester.exercise(true, null);
33 } // else if
34 else {
35 final FileTester fileTester = new FileTester(new File(args[0]));
36 results = fileTester.exercise(true, null);
37 } // else
38
39 final DefaultReporter reporter = new DefaultReporter();
40 reporter.report(results);
41 } // try
42 catch (TesterException e) {
43 System.out.println("Test failed: " + e.getMessage());
44 } // catch
45 } // main()
46 } // class Main