Install any skill in seconds. Free to start, no credit card required.
Get Started Free →wshobson/bats-testing-patterns
Master Bash Automated Testing System (Bats) for comprehensive shell script testing.
Passed 16 of 21 test cases with the skill, and 11 of 21 without it.
and 4 more in the full report
6 fixed11 passed either way4 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 6 test cases the skill fixed. Same model, same prompt, with and without the skill.
In a test file located in tests/unit/, how should I compute the absolute path to my target script located in bin/script.sh without using hardcoded relative paths from $PWD?
| Checked | Without skill | With skill |
|---|---|---|
| The script path is resolved relative to BATS_TEST_DIRNAME. | Missed | Passed |
The instructions your model reads when the skill loads.
Comprehensive guidance for writing comprehensive unit tests for shell scripts using Bats (Bash Automated Testing System), including test patterns, fixtures, and best practices for production-grade shell testing.
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
#!/usr/bin/env bats
@test "Function fails with missing file" {
run my_function "/nonexistent/file.txt"
[ "$status" -ne 0 ]
[[ "$output" == *"not found"* ]]
}
@test "Function fails with invalid input" {
run my_function ""
[ "$status" -ne 0 ]
}
@test "Function fails with permission denied" {
touch "$TMPDIR/readonly.txt"
chmod 000 "$TMPDIR/readonly.txt"
run my_function "$TMPDIR/readonly.txt"
[ "$status" -ne 0 ]
test cases passed, vs 11 / 21 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.