|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--com.artima.testkit.Runner
Application that runs a suite of tests. The application accepts command
line arguments that specify an optional runpath, zero to many Reporters, and zero to many
Suite classes. Runner can be started in either of two ways. If testkit.jar is available on the classpath,
then the command line takes the following form:
java [-cp <classpath>] com.artima.testkit.Runner [-p <runpath>] [reporter [...]] [-s <suiteclass> [...]]
If Runner is started using the executable jar file, the command line takes the following form:
java -jar testkit.jar -p <runpath> [reporter [...]] [-s <suiteclass> [...]]
A runpath is the list of filenames, directory paths, and/or URLs that testkit
uses to load classes for the running test. If runpath is specified, testkit creates
a java.net.URLClassLoader to load classes available on the runpath.
The graphical user interface can optionally reload the test classes for each run
by creating a new URLClassLoader for each run.
If the testkit JAR file is available from
the Java classpath, then the classes that comprise the test may also be made available on
the classpath and no runpath need be specified.
The runpath is specified with the -p option. The -p must be followed by a space,
a double quote ("), a whitespace-separated list of
paths and URLs, and a double quote. For example:
-p "serviceuitest-1.1beta4.jar myjini http://myhost:9998/myfile.jar"
Reporters can be specified on the command line in any of the following ways:
-g[configs...] - causes display of a graphical user interface that allows
tests to be run and results to be investigated
-f[configs...] <filename> - causes test results to be written to
the named file
-o[configs...] - causes test results to be written to
the standard output
-e[configs...] - causes test results to be written to
the standard error
-r[configs...] <reporterclass> - causes test results to be reported to
an instance of the specified fully qualified Reporter class name
The [configs...] parameter, which is used to configure reporters, is described in the next section.
The -r option causes the specified specified in
<reporterclass> to be
instantiated.
Each Reporter class specified with a -r option must be public, implement
com.artima.testkit.Reporter, and have a public no-arg constructor.
Reporter classes must be specified with fully qualified names. If the Testkit JAR file is
available on the classpath, not run directly as an executable JAR file, the specified
Reporter classes can also be
deployed on the classpath. If a runpath is specified with the
-p option, specified Reporter classes may also be loaded from the runpath.
All specified Reporter classes will be loaded and instantiated via their no-arg constructor.
For example, to run a suite using two reporters, the graphical reporter and the print reporter
writing to a file named "test.out", you would type:
-g -f test.out
The -g, -o, or -e options can
appear at most once each in any single command line.
Multiple appearances of -f and -r result in multiple reporters
unless the specified <filename> or <reporterclass> is
repeated. If any of -g, -o, -e,
<filename> or <reporterclass> are repeated on
the command line, the Runner will print an error message and not run the tests.
Runner adds the reporters specified on the command line to a dispatch reporter,
which will dispatch each method invocation on itself to each contained reporter. Runner will pass
the dispatch reporter to executed suites. As a result, every
specified reporter will receive every report generated by the running suite of tests.
If no reporters are specified, a graphical
runner will be displayed that provides a graphical report of
executed suites.
Each reporter specification on the command line can include configuration parameters. Configuration parameters
are specified immediately following the -g, -o,
-e, -f, or -r. Valid configuration parameters are:
Y - report runStarting method invocations
Z - report testStarting method invocations
T - report testSucceeded method invocations
F - report testFailed method invocations
U - report suiteStarting method invocations
P - report suiteCompleted method invocations
B - report suiteAborted method invocations
I - report infoProvided method invocations
S - report runStopped method invocations
A - report runAborted method invocations
R - report runCompleted method invocations
Each reporter has a default configuration. If no configuration
is specified on the command line for a particular reporter, that
reporter uses its default configuration. Runner will configure each reporter for
which configuration parameters are specified
via the reporter's setConfiguration method.
For example, to run a suite using two reporters, the graphical reporter (using its default configuration) and the print reporter configured to print only test failures, suite aborts, and run stops, and run aborts, you would type:
-g -eFBSA
Note that no whitespace is allowed between the reporter option and the initial configuration
parameters. So "-e FBSA" will not work, and must be
changed to "-eFBSA".
Suites are specified on the command line with a -s followed by the fully qualified
name of a Suite subclass, as in:
-s com.artima.serviceuitest.ServiceUITestkit
Each specified Suite class must be public, a subclass of
com.artima.testkit.Suite, and contain a public no-arg constructor.
Suite classes must be specified with fully qualified names. If the Testkit JAR file is available
on the classpath, not run directly as an executable JAR file, the specified Suite classes can be
loaded from the classpath. If a runpath is specified with the
-p option, specified Suite classes may also be loaded from the runpath.
All specified Suite classes will be loaded and instantiated via their no-arg constructor.
The runner will invoke execute on each instantiated com.artima.testkit.Suite,
passing in the dispatch reporter to each execute method.
| Method Summary | |
static void |
main(java.lang.String[] args)
App that runs a suite of tests. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static void main(java.lang.String[] args)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||