.\" generated with Ronn-NG/v0.9.1 .\" http://github.com/apjanke/ronn-ng/tree/0.9.1 .TH "BATS" "1" "November 2022" "bats-core" "Bash Automated Testing System" .SH "NAME" \fBbats\fR \- Bash Automated Testing System .SH "SYNOPSIS" Usage: bats [OPTIONS] \fItests\fR bats [\-h | \-v] .P \fItests\fR is the path to a Bats test file, or the path to a directory containing Bats test files (ending with "\.bats") .SH "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\. .P 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\. .P Test cases consist of standard shell commands\. Bats makes use of Bash\'s \fBerrexit\fR (\fBset \-e\fR) option when running test cases\. If every command in the test case exits with a \fB0\fR status code (success), the test passes\. In this way, each line is an assertion of truth\. .P See \fBbats\fR(7) for more information on writing Bats tests\. .SH "RUNNING TESTS" To run your tests, invoke the \fBbats\fR 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, \fBbats\fR exits with a \fB0\fR status code\. If there are any failures, \fBbats\fR exits with a \fB1\fR status code\. .P You can invoke the \fBbats\fR interpreter with multiple test file arguments, or with a path to a directory containing multiple \fB\.bats\fR files\. Bats will run each test file individually and aggregate the results\. If any test case fails, \fBbats\fR exits with a \fB1\fR status code\. .SH "FILTERING TESTS" There are multiple mechanisms to filter which tests to execute: .IP "\[ci]" 4 \fB\-\-filter \fR to filter by test name .IP "\[ci]" 4 \fB\-\-filter\-status \fR to filter by the test\'s status in the last run .IP "\[ci]" 4 \fB\-\-filter\-tags \fR to filter by the tags of a test .IP "" 0 .SH "\-\-FILTER\-TAGS TAG\-LIST" Tags can be used for finegrained filtering of which tests to run via \fB\-\-filter\-tags\fR\. This accepts a comma separated list of tags\. Only tests that match all of these tags will be executed\. For example, \fBbats \-\-filter\-tags a,b,c\fR will pick up tests with tags \fBa,b,c\fR, but not tests that miss one or more of those tags\. .P Additionally, you can specify negative tags via \fBbats \-\-filter\-tags a,!b,c\fR, which now won\'t match tests with tags \fBa,b,c\fR, due to the \fBb\fR, but will select \fBa,c\fR\. To put it more formally, \fB\-\-filter\-tags\fR is a boolean conjunction\. .P To allow for more complex queries, you can specify multiple \fB\-\-filter\-tags\fR\. A test will be executed, if it matches at least one of them\. This means multiple \fB\-\-filter\-tags\fR form a boolean disjunction\. .P A query of \fB\-\-filter\-tags a,!b \-\-filter\-tags b,c\fR can be translated to: Execute only tests that (have tag a, but not tag b) or (have tag b and c)\. .P An empty tag list matches tests without tags\. .SH "OPTIONS" .TP \fB\-c\fR, \fB\-\-count\fR Count the number of test cases without running any tests .TP \fB\-\-code\-quote\-style