mirror of
https://github.com/sstephenson/bats.git
synced 2024-11-17 11:42:33 +01:00
Document special variables
This commit is contained in:
parent
1c164cd272
commit
18b0517659
20
README.md
20
README.md
|
@ -99,3 +99,23 @@ load test_helper
|
||||||
will source the script `test/test_helper.bash` in your test file. This
|
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
|
can be useful for sharing functions to set up your environment or load
|
||||||
fixtures.
|
fixtures.
|
||||||
|
|
||||||
|
### Special variables
|
||||||
|
|
||||||
|
There are several global variables you can use to introspect on Bats
|
||||||
|
tests:
|
||||||
|
|
||||||
|
* `$BATS_TEST_FILENAME` is the fully expanded path to the Bats test
|
||||||
|
file.
|
||||||
|
* `$BATS_TEST_DIRNAME` is the directory in which the Bats test file is
|
||||||
|
located.
|
||||||
|
* `$BATS_TEST_NAMES` is an array of function names for each test case.
|
||||||
|
* `$BATS_TEST_NAME` is the name of the function containing the current
|
||||||
|
test case.
|
||||||
|
* `$BATS_TEST_DESCRIPTION` is the description of the current test
|
||||||
|
case.
|
||||||
|
* `$BATS_TEST_NUMBER` is the (1-based) index of the current test case
|
||||||
|
in the test file.
|
||||||
|
* `$BATS_TMPDIR` is the location to a directory that may be used to
|
||||||
|
store temporary files.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user