1 /* TestRunner.java */
2
3 package org.quilt.textui;
4
5 import java.util.Vector;
6
7 import org.quilt.cover.stmt.StmtRegistry;
8 import org.quilt.framework.QuiltTest;
9 import org.quilt.reports.*;
10 import org.quilt.runner.*;
11
12 /*** Text-interface test runner for Quilt. */
13
14 public class TestRunner extends Textui implements RunnerConst {
15
16 public TestRunner () { }
17
18 public static void main (String [] args ) {
19 System.exit( new TestRunner().handleArgs(args) );
20 }
21
22 /***
23 * Run an individual test.
24 *
25 * @param qt Quilt test descriptor.
26 * @param myFormatters Formatters pulled off the command line.
27 */
28 int runWithIt (QuiltTest qt, Vector myFormatters) {
29 // DEBUG
30 System.out.println("TestRunner.runWithIt - test " + qt.getName());
31 // END
32 int fmtCount = myFormatters.size();
33 Runner runner;
34 if (quiltLoader == null) {
35 runner = new BaseTestRunner(qt);
36 } else {
37 runner = new BaseTestRunner(qt, quiltLoader);
38 }
39 for (int i = 0; i < myFormatters.size(); i++) {
40 // it would be cruel to make this a one-liner ;-)
41 FmtSelector fs = (FmtSelector) myFormatters.elementAt(i);
42 runner.addFormatter ( (Formatter) fs.createFormatter() );
43 }
44 runner.run();
45 if (quiltLoader != null) {
46 if (stmtReg == null) {
47 System.out.println("TestRunner.runWithIt INTERNAL ERROR: "
48 + "no StmtRegistry found");
49 } else {
50 System.out.println( stmtReg.getReport() );
51 }
52 }
53 return runner.getRetCode();
54 }
55 }
This page was automatically generated by Maven