FitNesse.
CommandLineTestRunner

The New TestRunner


Reasons for running FitNesse tests from the command line.


Using the TestRunner

usage: java fitnesse.runner.TestRunner [options] host port page-name
        -v      verbose: prints test progress to stdout
        -results <filename|'stdout'>    save raw test results to a file or dump to standard output
        -html <filename|'stdout'>       format results as HTML and save to a file or dump to standard output
        -debug  prints FitServer protocol actions to stdout
        -nopath         prevents downloaded path elements from being added to classpath

There are three required arguments: host port page-name. The command to run all the FitNesse test suite on you local instance of FitNesse is:
java -cp fitnesse.jar fitnesse.runner.TestRunner localhost 80 FitNesse.SuiteAcceptanceTests

The TestRunner, regardless of options, exits with the number of failures + exceptions that occured during execution. An exit value of 0 means all the tests passed. However, without option the program lacks excitement. Adding the -v will give you somthing to watch. There are also other forms of output that are discussed below. The page designated by page-name may be either a suite or test page.

Dynamic Classpath

By default, the TestRunner will attempt to dynamically modify the classpath of the JVM that invoked the TestRunner class. This can avoid the annoyance of manually building a classpath. However, it must be used properly to be effective.
The dynamically modified classpath is generated by FitNesse in the same way it build the classpath for in-wiki executions; all of the inherited !path elements are accumulated. If these !path elements are fully qualified paths and the TestRunner is invoked on the same machine as the FitNesse server then the tests will probably run fine. If the !path elements are relative path then the TestRunner should be invoked from the working directory of the FitNesse server. If the TestRunner is invoked from another computer, good luck.

Output Formats

The TestRunner offers 3 different formats for output. HTML, XML, and a plain text format called Result format. The Result format is an intermediate format used to store the data while the test is executing. Unless otherwise directed, the results will simply go in a temporary file. After the tests are completed the results will be submitted back to FitNesse for formatting.

 Included page: FormattingOption

FormattingOption class

The formatting is accomplished through a separate java class called fitnesse.runner.FormattingOption. The FormattingOption class takes the raw Result format data and sends it back to FitNesse along with a few parameters. FitNesse will perform the formatting return the formatted data. The data is then stored in a file. HTML and XML are the supported formats.

This architectures was chosen to reduce the amount of rework needed in alternate implementations of FIT. A TestRunner need only run the tests and save the results in a Result format. The FormattingOption program can be invoked alone to perform the additional formatting.
Also, it allow one to archive results in the Result format and decide at a later time which format should be used if any.
Usage: java fitnesse.runner.FormattingOption <result filename> <format> <output filename> <host> <port> <root path>
        resultFilename: the name of the file containing test results
        format:         raw|html|xml|...
        outputfilename: stdout|a filename where the formatted results are to be stored
        host:           the domain name of the hosting FitNesse server
        port:           the port on which the hosting FitNesse server is running
        rootPath:       name of the test page or suite page

 The Deprecated version of TestRunner


[ User Guide] [.FrontPage] [.RecentChanges]