bats
Installation
SKILL.md
BATS Testing Framework
BATS (Bash Automated Testing System) is a TAP-compliant testing framework for Bash 3.2+. Think of it as JUnit for Bash—structured, repeatable testing for shell scripts.
Workflow Decision Tree
Creating New Test Suite
- Initialize project structure (see "Project Setup" below)
- Create test files with
.batsextension - Load helper libraries in
setup() - Write tests using
@testblocks
Writing Tests
- Testing script output? → Use
run+assert_output - Testing exit codes? → Use
run+assert_success/assert_failure - Testing file operations? → Use
bats-fileassertions - Mocking external commands? → See gotchas.md