PackageDescription: FitBundle(Bundle)


Fit Bundle

Last published: August 31, 2011 by 'randy'


This bundle provides Smalltalk implementations of the Framework for Integrated Tests (FIT) and FitNesse, a wiki wrapper around Fit. See http://fit.c2.com/ and http://www.fitnesse.org/ for details.

This version contains the equivalent features of the fit-java-1.1 release and the fitnesse-20050405 release.

Unit tests can be found in the Fit-Tests package. Fixture code to run the examples that come with the fit-java-1.1 distribution can be found in the Fit-Examples package. An SUnit test case to run the examples can be found in the Fit-Examples-Tests package. Fixture code to run the Fit specification tests can be found in the Fit-SpecFixtures package. Unit tests and an SUnit test case to run the specification tests can be found in the Fit-SpecFixtures-Tests package.

In order to run all of the tests, load the above mentioned packages, and then copy some files from the fit-java-1.1 distribution:
- copy the directory examples as a peer of your image file
- copy the directory spec as a peer of your image file
- copy the file examples/eg/music/Music.txt to src/eg/music/Music.txt relative to your image file

To view the results of running the examples and spec tests, run the ExternalExampleTest and SpecificationTest tests and view the HTML files in the examples/output and spec/output directories.

The Java Fitnesse implementation has forked the FIT source code to add some enhancements. Some of the changes are incompatible with the current FIT specification. In particular, Fitnesse uses CSS to "annotate" table cells with colors and labels that indicate test status, whereas FIT uses embedded markup in the HTML. Also, FItnesse allows much more flexibility in mapping fixture names in tables to fixture classes than the FIT spec allows.

In order to accommodate these differences, this implementation uses the FIT implementation when running the FIT batch test runner (see the FileRunner class), and uses the Fitnesse implementation when running the Fitnesse test server (see the FitServer class). The unit tests use whichever variant is appropriate.

If you are working in VisualWorks version 7.3 or later, load the package Fit-Subsystems and read the package comment for instructions on how to run Fit and Fitnesse.

Instructions for Running FIT
----------------------------------------

The FIT batch test runner can be run from within a development image, or from a command line using a deployed image.

To run from a development image, run the following in a workspace (using appropriate filenames for your operating system, of course):

Fit.FileRunner runInput: '' output: ''.

To run from a deployed image, set up your image to run either:

Fit.FileRunner runInput: '' output: ''.

or:

Fit.FileRunner new runWithArguments: and >.

where:
is the path to the html file containing the tests you want to run; and
is the path to the html file that will contain the results of running the tests.

Note that the image should be set up to immediately exit after running the tests.

Instructions for Running Fitnesse
------------------------------------------------

The main Fitnesse application is written in Java. It is necessary to get that running first. Fitnesse uses language-specific implementations of FitServer to actually run the tests. It is possible to run Smalltalk-based Fitnesse tests in either a development image or deployed image.

To run against a development image:

Fitnesse expects to launch an application that will connect back to it to retrieve the tests to run. A development image is normally already running, so we have to fake out Fitnesse. To do this:

- Create an executable shell script or batch file called fakeFitServer[.bat]. See DevelopmentFitServer class>>exampleFitServerBat or exampleFitServerShellScript. This script must be somewhere in your path.
- Create a Fitnesse page as described in DevelopmentFitServer class>>exampleFitnessePage.
- In a workspace, run:
server := DevelopmentFitServer new filename: ' asFilename.
[server loop] forkAt: Processor userBackgroundPriority.

You can now run your tests from Fitnesse and they will run against the fixtures in your development image.


To run from a deployed image, define a COMMAND_PATTERN in your Fitnesse pages that will launch your deployed executable. Your deployed executable should be set up to run the following command:

FitServer new runWithArguments:


Note that the image should immediately exit after running the tests.

Instructions for Running the Fitnesse Command-Line Test Runner
--------------------------------------------------------------------------

It is possible to run Fitnesse tests from a command-line using a deployed image. This is useful as part of a larger overall automated build process.

To run the command-line test runner, set up a deployed image that will run the following:

FitServer new runWithArguments:


The arguments are: [verbose] hostname port pageName resultsFilename

If "verbose" is specified, some simple progress information will be written to the Transcript (or wherever the deployed image redirects Transcript output). hostname and port specify the location of the Fitnesse server. pageName is the fully-qualified name of the Fitnesse page containing the tests to run. resultsFilename is the name of the file that will contain the test results.

Note that the image should immediately exit after running the tests.

The test results are written in Fitnesse' raw results format. To transform them to a more useful format, use the following java commandline:

java -cp fitnesse.runner.FormattingOption inputFilename outputFilename hostname port pageName

At the time of this writing, can be one of "raw", "html", or "xml". inputFilename is the same as the resutlsFilename created by running the tests.


If you have any questions or comments, contact me at rcoulman _at_ gmail _dot_ com.