From 392d2fa6a048d765670b4b7a3b1a1d33dc09611b Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Fri, 16 Nov 2012 15:32:30 -0600 Subject: [PATCH] Document test suites --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f49c097..c82c596 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,16 @@ description. } ``` +Bats is most useful when testing software written in Bash, but you can +use it to test any UNIX program. + 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. +## 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, and the results are written to standard output in human-readable [TAP @@ -45,8 +50,12 @@ You can also define special `setup` and `teardown` functions which run before and after each test case, respectively. Use these to load fixtures, set up your environment, and clean up when you're done. -Bats is most useful when testing software written in Bash, but you can -use it to test any UNIX program. +### Test suites + +You can also invoke the `bats` interpreter 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. ## Writing Bats tests