ocean.core.UnitTestRunner

Flexible unittest runner

This module provides a more flexible unittest runner.

The goals for this test runner is to function as a standalone program, instead of being run before another program's main(), as is common in D.

To achieve this, the main() function is provided by this module too.

To use it, just import this module and any other module you want to test, for example:

// Workaround: https://github.com/dlang/dub/issues/1761
module_ tester;
import ocean.core.UnitTestRunner;
import mymodule;

That's it. Compile with: dmd -unittest tester.d mymodule.d

You can control the unittest execution, try ./tester -h for help on the available options.

Tester status codes:

0 - All tests passed 2 - Wrong command line arguments 4 - One or more tests failed 8 - One or more tests had errors (unexpected problems) 16 - Error writing to XML file

Status codes can be aggregated via ORing, so for example, a status of 12 means both failures and errors were encountered, and status of 20 means failures were encountered and there was an error writing the XML file.

Members

Functions

main
int main(cstring[] args)

Main function that run all the modules unittests using UnitTestRunner.

Meta

License

Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).