bats(1) -- Bash Automated Testing System ======================================== SYNOPSIS -------- Usage: bats [OPTIONS] bats [-h | -v] is the path to a Bats test file, or the path to a directory containing Bats test files (ending with ".bats") DESCRIPTION ----------- Bats is a TAP-compliant testing framework for Bash. It provides a simple way to verify that the UNIX programs you write behave as expected. A Bats test file is a Bash script with special syntax for defining test cases. Under the hood, each test case is just a function with a description. Test cases consist of standard shell commands. Bats makes use of Bash's `errexit` (`set -e`) option when running test cases. If every command in the test case exits with a `0` status code (success), the test passes. In this way, each line is an assertion of truth. See `bats`(7) for more information on writing Bats tests. RUNNING TESTS ------------- To run your tests, invoke the `bats` interpreter with a path to a test file. The file's test cases are run sequentially and in isolation. If all the test cases pass, `bats` exits with a `0` status code. If there are any failures, `bats` exits with a `1` status code. You can invoke the `bats` interpreter with multiple test file arguments, or with a path to a directory containing multiple `.bats` files. Bats will run each test file individually and aggregate the results. If any test case fails, `bats` exits with a `1` status code. FILTERING TESTS --------------- There are multiple mechanisms to filter which tests to execute: * `--filter ` to filter by test name * `--filter-status ` to filter by the test's status in the last run * `--filter-tags ` to filter by the tags of a test --FILTER-TAGS ------------------------ Tags can be used for finegrained filtering of which tests to run via `--filter-tags`. This accepts a comma separated list of tags. Only tests that match all of these tags will be executed. For example, `bats --filter-tags a,b,c` will pick up tests with tags `a,b,c`, but not tests that miss one or more of those tags. Additionally, you can specify negative tags via `bats --filter-tags a,!b,c`, which now won't match tests with tags `a,b,c`, due to the `b`, but will select `a,c`. To put it more formally, `--filter-tags` is a boolean conjunction. To allow for more complex queries, you can specify multiple `--filter-tags`. A test will be executed, if it matches at least one of them. This means multiple `--filter-tags` form a boolean disjunction. A query of `--filter-tags a,!b --filter-tags b,c` can be translated to: Execute only tests that (have tag a, but not tag b) or (have tag b and c). An empty tag list matches tests without tags. OPTIONS ------- * `-c`, `--count`: Count the number of test cases without running any tests * `--code-quote-style