Welcome to bats-core’s documentation!¶
Versions before v1.2.1 are documented over there.
- Docker Usage Guide
- Writing tests
- Comment syntax
run: Test other commands
load: Share common code
bats_load_library: Load system wide libraries
skip: Easily skip tests
teardown: Pre- and post-test hooks
- Code outside of test cases
- File descriptor 3 (read this if Bats hangs)
- Printing to the terminal
- Special variables
- Libraries and Add-ons
- My test fails although I return true?
- My negated statement (e.g. ! true) does not fail the test, even when it should.
- I cannot register a test multiple times via for loop.
- I cannot pass parameters to test or .bats files.
- Why can’t my function return results via a variable when using run?
- run doesn’t fail, although the same command without run does.
- load won’t load my .sh files.
- I can’t lint/shell-format my bats tests.
- The output (stdout/err) from commands under run is not visible in failed tests.
- My piped command does not work under run.
- [[ ]] (or (( )) did not fail my test
- Background tasks prevent the test run from terminating when finished
- How do I set the working directory?
- How do I see the output of the command under run when a test fails?
- Can I use –filter to exclude files/tests?
- How can I exclude a single test from a test run?
- How can I exclude all tests of a file from a test run?
- How can I include my own .sh files for testing?
- How can I debug a failing test?
- Is there a mechanism to add file/test specific functionality to a common setup function?
- How can I use helper libraries like bats-assert?
- How to set a test timeout in bats?
- How can I lint/shell-format my bats tests?
- How can I check if a test failed/succeeded during teardown?
- How can I setup/cleanup before/after all tests?