-
Running Funittest
last modified April 26 by thefunny
You can run Funittest test with the script called funittest.
This script will search for an instance and seleniumrc script in the same script directory, and run them in the background. The purpose is to start your Zope/Server instance and Selenuim before running any test. Of course you can always starts them by yourself, and they don't need to be restarted between each test. If you don't want this behavior, you can use the funittest_simple script, which are going to run the test in the same way, but which doesn't try to do this.
You can select a product to run test with -p product_name, and select an independent test with -t test_name. If there is no product selected, the default one is going to be used, and if no test is selected, all available test in the product are going to be run.
Advanced options are:
- -e ext is going to select the test extension called ext,
- --preset pset is going to use the preset called pset instead of the default one.
Other interesting options are:
- -v for verbose mode, every step made is going to be reported in the console,
- --pause which going to make Funittest stop after each test, waiting for the user to press enter,
- --doc is going to list, with a small documentation each available product and test,
- --help is going to display an help about option, and default values.
Note:
- It's recommended to start your Zope instance by yourself them you wrote your Funittest test, this can reduce considerably the running time of each test,
- You can write a configuration file to get shorter commands: Using the configuration file of Funittest .
Automatic Zope Configuration
Funittest eggs may contains some code which lets you initialize automaticaly your Zope instance from scratch. This is usefull to create instances for buildbots. The funittest_zope command does this work, however you don't have to run it directly from a shell, but by using your zopectl script:
$ bin/zopectl path/to/funittest_zope funittest.plone
Command arguments are a list of Funittest eggs in which initialization are going to be searched.
Of course, you have to run it only one time before running your tests, when you don't have any setup done (like you have an empty Data.fs). If you used the Funittest buildout, this have been already done for you.
Documentation generation
The script called funittest_doc will let you generate a HTML file containing a reference of all defined models. This can be usefull if you want to search a test implementation throught all existing models.
Funittest Buildout
If you used buildout, you will a few scripts more:
- python : it's a clean python interpreter made from the one of your system. This prevent bad interaction with python extension you could already have on your computer,
- python_funittest : it's a python interpreter which contains all funittest modules,
- test_funitest : Funittest contains test to test itself. This script runs them.
If you're under Unix with a shell, you can do:
$ . bin/activate
This going to add the bin directory of buildout to your PATH, so you will be able to run directly funittest without specifying any prefix bin/ to your commands. This going to work only for the current shell session.