From 1be005c7840c712d3c2c0be8525fd634c7300e16 Mon Sep 17 00:00:00 2001 From: Pierre Prinetti Date: Mon, 10 Jul 2017 17:21:25 +0200 Subject: [PATCH] document setup and teardown --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index b85244d..c11a870 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,28 @@ That would produce the following output: 3 tests completed. +### Setup and Teardown + +In `some_test.sh`: + + #!/usr/bin/env bash + + before() { + export CAKE_FILLER='chocolate' + } + + test_app_configuration_through_env { + $response=$(curl -s http://my.website.com/cake-filler) + echo "$response" | grep -q "chocolate" + } + + after() { + unset CAKE_FILLER + } + +`before` and `after` functions are executed before and after executing +the tests from the current file. + ## License bash-test is released under the [MIT License][2].