• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

Prolog Unit Tests
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • Prolog Unit Tests
        • Introduction
        • A Unit Test box
        • Using separate test files
        • Running the test-suite
          • Running the test suite from Prolog
          • Running the test suite from the command line
        • Tests and production systems
        • Controlling the test suite
        • Auto-generating tests
        • Portability of the test-suite
        • Motivation of choices

4 Running the test-suite

4.1 Running the test suite from Prolog

To run tests from the Prolog prompt, first load the program and then run run_tests/0 or run_tests(+Unit).

run_tests
Run all test-units.
run_tests(+Spec)
Run only the specified tests. Spec can be a list to run multiple tests. A single specification is either the name of a test unit or a term <Unit>:<Tests>, running only the specified test. <Tests> is either the name of a test or a list of names. Running particular tests is particularly useful for tracing a test:5Unfortunately the body of the test is called through meta-calling, so it cannot be traced. The called user-code can be traced normally though.
?- gtrace, run_tests(lists:member).

To identify nonterminating tests, interrupt the looping process with Control-C. The test name and location will be displayed.

4.2 Running the test suite from the command line

To run a file's tests from the command line, run the following command, replacing your/file.pl with the path to your file.

swipl -g run_tests -t halt your/file.pl

Prolog will (1) load the file you specify, as well as any modules it depends on; (2) run all tests in those files, and (3) exit with status 0 or 1 depending on whether the test suite succeeds or fails.

If you want to test multiple files, you can pass multiple ..pl files.

ClioPatria (version V3.1.1-51-ga0b30a5)