With bandit you create a command line application that runs all registered tests, reports the result on stdout, and then exits with an error level 0 if all tests passed, and an error level greater than 0 if some tests did not passed.
Bandit enables you to tweak the way tests results are reported by allowing you
to specify command line switches. Running
[name of your executable] --help
will list the available options.
$ my-exe --help USAGE: <executable> [options] Options: --version, Print version of bandit --help, Print usage and exit. --reporter=<reporter>, Select reporter (dots, singleline, xunit, spec) --no-color, Suppress colors in output --formatter=<formatter>, Select formatting of errors (default, vs) --skip=<substring>, skip all 'describe' and 'it' containing substring --only=<substring>, only run 'describe' and 'it' containing substring
You can specify how you want bandit to report the progress and result of a test
run by using the
--reporter=dotsis the default. Each executed test will be printed as a dot or as an ‘F’ or ‘E’ depending on whether it succeeds or not.
--reporter=singlelinereports the progress on a single line. Updating counters of executed, failed and skipped tests.
--reporter=xunitreports the test results in a xml format supported by most continuous integration servers.
--reporter=specreports the tests in a format similar to how they are written along with the status of each test.
--formatter=<formatter> option you can specify how bandit reports
failed assertions. Different editors expect errors to be reported in different
ways to be able to quickly navigate to the location of a faile assertion.
The default behavior is to report errors as
/file/path:line: <error message>
This matches how gcc and clang reports errors.
--formatter=vs matches how visual studio wants errors reported.
By default, bandit uses colors to highlight the status of the current test run.
In certain IDE’s or when running tests in continuous integration environment, this
may look ugly. By specifying
--no-color you can tell bandit to stop using colors.
You can skip tests from within your source code by using the
It is also possible to temporarily skip tests by using the
command line option. By using this, you tell bandit to skip running all
it() whose names contain
It is also possible to tell bandit to only run a subset of the tests by passing
--only=<substring>. This will cause bandit to only run those
it() whose names contain