- GOTCHAS AND LIMITATIONS
- SEE ALSO
- COPYRIGHT AND LICENSE
Test::C2FIT - A direct Perl port of Ward Cunningham's FIT acceptance test framework for Java.
This document describes Test::C2FIT version 0.06
FileRunner.pl input_containing_fit_tests.html test_results.html perl -MTest::C2FIT -e file_runner input_containing_fit_tests.html test_results.html perl -MTest::C2FIT -e fit_shell
Great software requires collaboration and communication. Fit is a tool for enhancing collaboration in software development. It's an invaluable way to collaborate on complicated problems - and get them right - early in development.
Fit allows customers, testers, and programmers to learn what their software should do and what it does do. It automatically compares customers' expectations to actual results.
This port of FIT has a featureset equivalent to v1.1 of FIT. Dave W. Smith's original port was based on fit-b021021j and I've updated most of the core to match the 1.1 version.
This port passes the current FIT spec and also implements a all of the examples.
The following functions are provided (and exported) by this module:
Process a FIT-document contained in $infile and writes the result to $outfile.
Same as file_runner, except that not <table>, <tr> and <td> but <wiki>, <table>, <tr> and <td> is searched for in the input document.
Creates an interactive shell from which you can easily run tests. Start it and enter "help" for more information.
Suppose, your tests-related files reside in a directory with three subdirectories: input - where the files come from, output - where the results will be written to and lib - where your fixtures reside, all you need to do is just to enter "runall"
The file_runner and wiki_runner support filtering of warn messages, similar to java's common logging. To change the log level, use the -L parameter, e.g.:
perl -MTest::C2FIT -e file_runner -- -L 1 input_containing_fit_tests.html test_results.html
There are following log levels defined: 0 - trace, 1 - debug, 2 - info, 3 - warn, 4 - error, 5 - fatal.
In your code, simply use
warn "message" if it should be printed out unconditionally or
warn 1, " message" if it should be printed out, when log level is either TRACE or DEBUG.
In your FIT-documents, please use the java-style dot-notation for qualifying package names. E.g. if you want the package Domain::Object::Simple to be used, specify it by entering Domain.Object.Simple into your fit document.
Package names should be fully qualified, case is importat. Special care is taken on the fit.* packages, these can be specified either by fit.Name as well as Test.C2FIT.Name.
1) Java is a strongly typed language; Perl is not. The Java version of FIT cares a lot about types, but Perl takes a more relaxed view of things and this port reflects that.
2) Perl supports limited introspection. Because there are no method signatures, it isn't possible to determine method return types. If you want to use TypeAdapters you have to supply hints. (see examples)
3) Some of the tests from the 'examples' directory expect Java behaviour for arithmetic (e.g. integer overflow). Perl doesn't have this type of overflow so these tests will "fail".
4) The MusicExample uses a clock that doesn't have millisecond accuracy. This throws off the clock by a second during one of the tests.
5) Perl supports a limited set of primitive types. Dave has used a GenericTypeAdapter that knows about strings and numbers (and pretends to know about booleans).
Extensive and up-to-date documentation on FIT can be found at: http://fit.c2.com/
The 'examples' directory of this distribution contains some sample FIT tests and sample applications that they test. Invoke FileRunner.pl on any of the test input files from examples/input and view the output in a browser. To invoke the tests use do_tests.bat / do_tests.sh in the appropriate directory.
The directory examples-perl contains examples written for this perl-port only.
You should also examine and run the tests in the 'spec' directory. These are FIT's own acceptance tests.
Original port from the Java version by Dave W. Smith.
Updates and modifications by Tony Byrne <firstname.lastname@example.org>. Further modifications by Martin Busik <email@example.com>.
Copyright (c) 2002-2006 Cunningham & Cunningham, Inc. Released under the terms of the GNU General Public License version 2 or later.