Next: PlUnit Tests and Production Systems, Previous: PlUnit A Unit Test Box, Up: lib-plunit [Contents][Index]
At any time, the tests can be executed by loading the program and
running run_tests/[0,1,2]
:
run_tests
Run all individual tests of all test-units.
run_tests(Spec)
run_tests(Spec,Options)
Run only the specified tests. The following options are available:
quiet
Suppresses informational messages.
verbose
Prints informational messages, e.g. messages for each successful test. This is the default.
passed(Count)
failed(Count)
skipped(Count)
Binds Count to the number of non-blocked tests that were successful, failed or skipped, respectively. A test is skipped if one of its conditions fails.
The following will quetly run all tests, but print messages and fail if any of the tests were unsuccessful.
| ?- run_tests(all, [failed(0), quiet]).
Spec should be one of:
all
, to run all tests. This is the default i.e. what
run_tests/0
does.
Running single tests is particularly useful for tracing a test, e.g.:
| ?- trace, run_tests(lists:reverse).
run_tests/[0,1,2]
prints a report during execution. The
quiet
options suppresses informational messages; in its absence,
messages are printed in full as follows.
First, each test-unit report begins with a header:
% PL-Unit: Unit
Then comes a message (success or failure) for all specified tests not
marked as blocked
or fixme
. Success messages are
informational; others are error or warning messages. Any errors
encountered while executing options are also reported. To close the
test-unit, a footer is printed:
% done
After all test-units, a summary report is printed, stating:
fixme