Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #59 from Zearin/patch-1
Browse files Browse the repository at this point in the history
Minor edits to README.md
  • Loading branch information
sstephenson committed Jun 10, 2014
2 parents bd23c38 + b2cc8ea commit 91feff9
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions README.md
@@ -1,6 +1,6 @@
# Bats: Bash Automated Testing System

Bats is a [TAP](http://testanything.org/)-compliant testing framework
Bats is a [TAP](http://testanything.org)-compliant testing framework
for Bash. It provides a simple way to verify that the UNIX programs
you write behave as expected.

Expand Down Expand Up @@ -30,6 +30,7 @@ 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
Expand All @@ -48,9 +49,10 @@ an "X" if it fails.
2 tests, 0 failures

If Bats is not connected to a terminal—in other words, if you
run it from a continuous integration system or redirect its output to
run it from a continuous integration system, or redirect its output to
a file—the results are displayed in human-readable, machine-parsable
[TAP format](http://testanything.org).

You can force TAP output from a terminal by invoking Bats with the
`--tap` option.

Expand All @@ -66,18 +68,19 @@ arguments, or 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 tests

Each Bats test file is evaluated n+1 times, where _n_ is the number of
Each Bats test file is evaluated _n+1_ times, where _n_ is the number of
test cases in the file. The first run counts the number of test cases,
then iterates over the test cases and executes each one in its own
process.

For details about exactly how Bats evaluates test files, see [Bats
Evaluation Process](https://github.com/sstephenson/bats/wiki/Bats-Evaluation-Process)
For more details about how Bats evaluates test files, see
[Bats Evaluation Process](https://github.com/sstephenson/bats/wiki/Bats-Evaluation-Process)
on the wiki.

### The _run_ helper
### `run`: Test other commands

Many Bats tests need to run a command and then make assertions about
its exit status and output. Bats includes a `run` helper that invokes
Expand Down Expand Up @@ -114,7 +117,7 @@ the first line:
}
```

### The _load_ command
### `load`: Share common code

You may want to share common code across multiple test files. Bats
includes a convenient `load` command for sourcing a Bash source file
Expand All @@ -129,7 +132,7 @@ will source the script `test/test_helper.bash` in your test file. This
can be useful for sharing functions to set up your environment or load
fixtures.

### The _skip_ command
### `skip`: Easily skip tests

Tests can be skipped by using the `skip` command at the point in a
test you wish to skip.
Expand Down Expand Up @@ -165,9 +168,9 @@ Or you can skip conditionally:
}
```

### Setup and teardown functions
### `setup` and `teardown`: Pre- and post-test hooks

You can define special `setup` and `teardown` functions which run
You can 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.

Expand Down Expand Up @@ -199,6 +202,7 @@ in the test file.
* `$BATS_TMPDIR` is the location to a directory that may be used to
store temporary files.


## Installing Bats from source

Check out a copy of the Bats repository. Then, either add the Bats
Expand All @@ -213,6 +217,7 @@ Bats. For example, to install Bats into `/usr/local`,
Note that you may need to run `install.sh` with `sudo` if you do not
have permission to write to the installation prefix.


## Support

The Bats source code repository is [hosted on
Expand All @@ -227,7 +232,8 @@ To learn how to set up your editor for Bats syntax highlighting, see
[Syntax Highlighting](https://github.com/sstephenson/bats/wiki/Syntax-Highlighting)
on the wiki.

### Version history

## Version history

*0.3.1* (October 28, 2013)

Expand Down

0 comments on commit 91feff9

Please sign in to comment.