Stages in Using Getest |
|
This section lists the steps to follow to produce and run a
test suite using getest. First, you have to write test
case classes to be used in the test suite:
- Create classes whose names match the regular expression
specified in the class
clause of the default
section of the configuration
file. By default the name of these classes should
have the prefix TEST_.
- Inherit from class TS_TEST_CASE
from the test harness cluster of the Gobo Eiffel Test
Library, and declare make_default
as creation procedure.
- Write argumentless procedures whose names match the
regular expression specified in the feature
clause of the default
section of the configuration
file. By default the name of these routines should
have the prefix test_.
These routines will be called by the generated test suite
to exercise some Eiffel code. They should typically
contain calls to assertion
routines (routines with names starting with assert)
inherited from TS_TEST_CASE
(these assertions routines are actually written in the
ancestor class TS_ASSERTION_ROUTINES).
Then you should write a configuration
file to run the test:
- Specify the name of the test suite in the test
section.
- If the names of the test case classes do not start with TEST_, then
specify the proper regular expression in the class
clause of the default
section.
- If the names of the test routines in the test case
classes do not start with test_,
then specify the proper regular expression in the feature
clause of the default
section.
- Specify the prefix to be used for the generated class
names in the prefix
clause of the default
section if different from the default.
- If the new classes should be generated in a directory
other than the current directory, specify the name of
that directory in the testgen
clause of the default
section.
- Specify in the compile
clause of the default
section the command-line instruction with the chosen
Eiffel compiler to be used by getest to compile
the test suite program.
- Specify in the execute
clause of the default
section the command-line instruction to be used by getest
to run the test suite program.
- Finally the clusters containing the test case classes
that you wrote above should be listed in the cluster
section.
You should also provide the ECF file
necessary to run the compilation instructions specified in the compile
clause of the default
section of the configuration file above:
- The root class has the same name as the name of the test
suite specified in the test
section of the configuration file above.
- The creation procedure is make.
- The clusters specified in the cluster
section of the configuration file should also be listed
here.
- The directory where the new classes will be generated
(specified by the testgen
clause of the default
section of the configuration file) should also be listed
here.
- Depending on the Eiffel compiler you are using these
other clusters should also be listed:
-- Gobo Eiffel Test Harness Library
$GOBO/library/test/src/harness
-- Gobo Eiffel Structure Library
$GOBO/library/structure/src/container
$GOBO/library/structure/src/dispenser
$GOBO/library/structure/src/list
$GOBO/library/structure/src/set
$GOBO/library/structure/src/sort
$GOBO/library/structure/src/support
$GOBO/library/structure/src/table
-- Gobo Eiffel Utility Library
$GOBO/library/utility/src/command
$GOBO/library/utility/src/error
$GOBO/library/utility/src/formatter
$GOBO/library/utility/src/support
-- Gobo Eiffel Kernel Library
$GOBO/library/kernel/src/basic
$GOBO/library/kernel/src/elks
$GOBO/library/kernel/src/io
$GOBO/library/kernel/src/misc
$GOBO/library/kernel/src/unicode
$GOBO/library/kernel/src/support
$GOBO/library/kernel/src/spec/<compiler>
where <compiler>
is either ge, ise.
You can then run getest
with the configuration file as input and the output should look
something like that:
Preparing Test Cases
Compiling Test Cases
Running Test Cases
Test Summary for my_test
# PASSED: 1 test
# Failed: 0 test
# Aborted: 0 test
# Total: 1 test (2 assertions)