Skip to content

Testing

Paulo Moura edited this page Apr 3, 2014 · 47 revisions

Two sets of unit tests are distributed with Logtalk. One in the tests subdirectory and another in the examples subdirectory. You can run these unit tests or your own unit tests by using the provided scripts/logtalk_tester.sh shell script.

Automating running unit tests on POSIX systems

In a POSIX system, you can run the provided unit tests by typing:

$ cd $LOGTALKUSER/tests
$ logtalk_tester -p <back-end Prolog compiler>
...
$ cd ../tools
$ logtalk_tester -p <back-end Prolog compiler>
...
$ cd ../examples
$ logtalk_tester -p <back-end Prolog compiler>
...

If you didn't use one of the provided Logtalk installers or installation script, you may need to type logtalk_tester.sh instead of just logtalk_tester.

There are also a few unit tests in the contributions folder:

$ cd $LOGTALKUSER/contributions
$ logtalk_tester -p <back-end Prolog compiler>
...

To identifiers for the supported back-end Prolog compilers can be listed by typing:

$ logtalk_tester -h
...

Logtalk source code can be compiled in three different modes: optimal, normal, and debug. The logtalk_tester accepts an option, -m, to set the mode to be used to run the unit tests. Be aware, however, that running the unit tests in debug mode can take considerably more time compared with the other two modes.

Note that, when running the unit tests using stable Logtalk releases, failed tests usually result from bugs in the backend Prolog compilers or from their lack of compliance with official and de facto standards. The most common issue is non-standard exception handling. These issues can only be fixed by the developers of those Prolog compilers.

Automating running unit tests on Windows systems

The logtalk_tester.sh script can also be used on Windows operating-systems by installing Git for Windows, which includes a bash shell implementation. After installation, you can start the bash shell by selecting Git Bash from the context menu. You will also need to add the $LOGTALKHOME/scripts and $LOGTALKHOME/integration directories plus the backend Prolog compiler executable directories to the system path environment variable.

Clone this wiki locally