Search code examples
swi-prologlogtalk

Logtalk : what is the best way to run all test suites?


In Logtalk code examples, each example provides its own test suite which is runnable in a "standalone" mode (one test suite at once).

But, as the title says, I'm interested in the best approaches of testing all test suites (all loaded objects inheriting lgtunit in my app) at once, and having one single summary of all tests execution at the end (total passed / skipped / failed).

For example, in SWI-Prolog, run_tests/0 run all test-units.


Solution

  • Here is a first implementation of a runner object to run all registered test suites : https://github.com/koryonik/logtalk-experiments/tree/master/test-runner

    Usage is simple :

    Simply run all loaded lgtunit test suites :

    test_runner::autoregister_tests, % register all loaded lgtunit objects
    test_runner::run_tests.
    

    Or Manually register test suites you want to run :

    test_runner::register_tests(test_suite_obj1),
    test_runner::register_tests(test_suite_obj2),
    test_runner::run_tests. %run the 2 test suites