Next: , Previous: , Up: lib-plunit   [Contents][Index]


10.34.4 Running the Test-Suite

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 quietly 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:

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:



Send feedback on this subject.