BATS testing framework¶
Install in project¶
git submodule add https://github.com/bats-core/bats-core.git tests/bats
git submodule add https://github.com/bats-core/bats-support.git tests/test_helper/bats-support
git submodule add https://github.com/bats-core/bats-assert.git tests/test_helper/bats-assert
Usage¶
run
:¶
- returns 0
- stores stdout/stderr in
$output
- stores the exit code in
$status
and returns 0
setup()
¶
- Run before each test.
setup_file()
¶
- Run before each file.
teardown()
¶
A test ends at its first failure. None of the subsequent commands in this test will be executed. The teardown function runs after each individual test in a file, regardless of test success or failure. Similarly to setup, each .bats file can have its own teardown function which will be the same for all tests in the file.
teardown()
¶
Run after each file.
skip
¶
Skip a test and provide explanatory message: