Using FitNesse to write and run test is nice, but sometimes you want to run the tests as part of an automatic build cycle. FitNesse has this possibility, and fit4delphi comes with a testrunner that makes it possible with delphi code as well.
In the fit4delphi package, inside the testrunner folder, you will find a project named DelphiTestRunner.dproj. You can use this project to automatically run a test, or a suite of tests, and store the result as a file. To do his, you have to tell the testrunner where the FitNesse server is running, and which file and in what format the result should be store in. This is done with command line parameters in the given form:
DelphiTestRunner.exe [options] host port page
Host and port must be the same as specified when starting FitNesse. The page parameter is the url for the wiki page you want to test. All subpages of this page will also be tested.
There are multiple options you can specify.
This option will print FitNesse protocol actions to the console.
This option should give a verbose output about test progress to the console, but personally, I can’t make it work…
- -results file
The result of the testrun is saved to a textfile with the given name.
- -html file
The result of the testrun is saved to a html file with the given name.
- -xml file
The result of the testrun is saved to a xml file with the given name. The xml format is given in the userguide.
This option will make FitNesse ignore !path options specified in the wiki pages.
- -suiteFilter filter
Specifying a filter will only run pages with tags matching the filter. You can read more about this in the userguide.
An example of a command line could be some thing like this:
DelphiTestRunner.exe –html results.html localhost 80 MyTestSuite