-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
putting tests at next level #5
Comments
hm, could you visualize schema you have in mind? pseudocode will be anough. because i am afraid i do not fully understand how it should look like. |
testAll.sh is sort of a generic test runner. Sometimes you need to create a scenario for the test to run (in this case you need to create repositories, directories, etc). Sometimes this scenario is common for all the tests, and sometimes is different. The idea is something like: #!/usr/bin/env bash
set -e
cd "$(dirname "$0")"
if [ -e "./setUp.sh" ];then
bash "./setUp.sh"
fi
countTests=0
countFailed=0
for testCase in $(ls -d */)
do
{
countTests=$((countTests + 1))
expected="$(cat $testCase/expected)"
# execute if present bash $testCase/setUp.sh
actual="$(bash $testCase/command.sh)"
# execute if present bash $testCase/tearDown.sh
# all other stuff
}
done
if [ -e "./tearDown.sh" ];then
bash "./tearDown.sh"
fi
# all other stuff The setUp.sh scripts are optional and used to prepare scenarios |
oh, thank you! i like this, so i should create TestAll.sh make more generic, aye? copy :) |
extended duplicate of #4 |
i decidet this should be sole PR... :) thx @franiglesias ! :) |
|
Yesterday I was thinking in a sort of set up (prepare scenario) and tear down (remove scenario) for test cases, and just see pr #4 where you implement in part this idea.
In fact, what I am thinking of is a sort of "callback" in the testAll.sh script that looks for and execute a global set up (and tear down after all tests are finished) and even one test case based.
With this you can isolate the scenario creation from the test itself so they will become easier to understand.
The text was updated successfully, but these errors were encountered: