2024-02-24 15:33:51 +00:00
|
|
|
# bats
|
|
|
|
|
|
|
|
> Bash Automated Testing System: a TAP (<https://testanything.org/>) compliant testing framework for Bash.
|
|
|
|
> More information: <https://bats-core.readthedocs.io/en/stable/usage.html>.
|
|
|
|
|
2024-07-10 22:42:29 +01:00
|
|
|
- Run a BATS test script and output results in the [t]AP (Test Anything Protocol) format:
|
2024-02-24 15:33:51 +00:00
|
|
|
|
|
|
|
`bats --tap {{path/to/test.bats}}`
|
|
|
|
|
2024-07-10 22:42:29 +01:00
|
|
|
- [c]ount test cases of a test script without running any tests:
|
2024-02-24 15:33:51 +00:00
|
|
|
|
|
|
|
`bats --count {{path/to/test.bats}}`
|
|
|
|
|
2024-07-10 22:42:29 +01:00
|
|
|
- Run BATS test cases [r]ecursively (files with a `.bats` extension):
|
2024-02-24 15:33:51 +00:00
|
|
|
|
|
|
|
`bats --recursive {{path/to/directory}}`
|
|
|
|
|
2024-07-10 22:42:29 +01:00
|
|
|
- Output results in a specific [F]ormat:
|
2024-02-24 15:33:51 +00:00
|
|
|
|
2024-07-10 22:42:29 +01:00
|
|
|
`bats --formatter {{pretty|tap|tap13|junit}} {{path/to/test.bats}}`
|
|
|
|
|
|
|
|
- Add [T]iming information to tests:
|
|
|
|
|
|
|
|
`bats --timing {{path/to/test.bats}}`
|
|
|
|
|
|
|
|
- Run specific number of [j]obs in parallel (requires GNU `parallel` to be installed):
|
|
|
|
|
|
|
|
`bats --jobs {{number}} {{path/to/test.bats}}`
|