Selftest is the acceptant test framework for Narval.
It provides the actions necessary to run the validation tests for the
Narval kernel and Narval actions / recipes.
Running test
------------
The base command to run test is the tcrun.py command. It will use
the NARVAL_HOME environment variable to detect the Narval home
directory that should be used to launch tests. (tcprun.py can be found
in the tools directory of the narval core)
1) python tcrun.py all
(give -h/--help option to have a full description of available
commands)
this will runs all tests and create and out.html file in the current
directory containing all the tests results.
2) python tcrun.py 001
email.read_new1
run tests 001 and email.read_new1. You can launch a group of tests
by typing a Python regular expression matching the test name (without
extension):
python tcrun.py "email.*"
run all tests beginning with "email"
3) narval-test clean
this remove all the temporary files created while testing.
Add a new test
--------------
1) add a memory file in the directory NARVAL_HOME/tests/cases/ with a name
according to the regular expression "\d\d\d(bis)?.xml" (where \d mean
a decimal digit) for kernel test or "group.name(\d)?.xml" for
action/transform test. The memory must contain a element
containing some text which describes the test purpose, category and
the recipe to instantiate to start the test (usually the recipe itself
is contained in the memory file).
See others files in this directory for example.
2) add a validate file in the directory NARVAL_HOME/tests/validate/
with a name according to the regular expression "val-\d\d\d(bis)?.py"
or "val-group.name(\d)?.py" and should of course match the test
name. This file is a python module, where the name "memory" is bound
to the list of elements in narval's memory after the test
execution. You can make whatever test you want in this module, any
exception will notice a failure.
3) in order to decrease the time used for the test, you can add a
narvalrc file in the directory NARVAL_HOME/tests/rc. For the kernel
tests (matching "\d\d\d(bis)?"), the rc file is "selftestrc.xml" while for
applications tests (matching "group.name(\d)") , the rc file is
"grouprc.xml".
For more information, see http://www.logilab.org/projects/narval.