commands.sh

bats

all

Bash Automated Testing System: a TAP (<https://testanything.org/>) compliant testing framework for Bash.

More info →

Options (6)

-t, --tapboolean

Run a BATS test script and output results in the TAP (Test Anything Protocol) format

Example: bats {{[-t|--tap]}} {{path/to/test.bats}}
-c, --countboolean

Count test cases of a test script without running any tests

Example: bats {{[-c|--count]}} {{path/to/test.bats}}
-r, --recursiveboolean

Run BATS test cases recursively (files with a `.bats` extension)

Example: bats {{[-r|--recursive]}} {{path/to/directory}}
-F, --formatterboolean

Output results in a specific format

Example: bats {{[-F|--formatter]}} {{pretty|tap|tap13|junit}} {{path/to/test.bats}}
-T, --timingboolean

Add timing information to tests

Example: bats {{[-T|--timing]}} {{path/to/test.bats}}
-j, --jobsboolean

Run specific number of jobs in parallel (requires GNU `parallel` to be installed)

Example: bats {{[-j|--jobs]}} {{number}} {{path/to/test.bats}}

Examples (6)

Run a BATS test script and output results in the TAP (Test Anything Protocol) format

bats [-t|--tap] path/to/test.bats

Count test cases of a test script without running any tests

bats [-c|--count] path/to/test.bats

Run BATS test cases recursively (files with a `.bats` extension)

bats [-r|--recursive] path/to/directory

Output results in a specific format

bats [-F|--formatter] pretty|tap|tap13|junit path/to/test.bats

Add timing information to tests

bats [-T|--timing] path/to/test.bats

Run specific number of jobs in parallel (requires GNU `parallel` to be installed)

bats [-j|--jobs] number path/to/test.bats
made by @shridhargupta | data from tldr-pages