bash_test_tools
bash_test_tools copied to clipboard
How do I run more then one test file?
Lets say I have the following directory and test files:
testDir: -- myTestA.sh -- myTestB.sh -- ect...
How do I go about running all the tests? Do I have to run them one at a time?
Thanks. Great Framework!
Hi Evan, Thanks for compliment - you may well be the first user besides me, so expect bugs. To answer your question first, in case its not clear in docs... in your test scripts you can define as many tests as you like
function test_foo1 { ... } function test_foo2 { ... } etc...
and they will all run when you execute the script.
Regarding calling tests from other scripts, that is a feature that I have not given thought to.
For now you could do one of three things,
- as you said run them all at one time,
$ for x in testDir/*.sh; do ./$x; done
- create a master script that runs those other scripts one at a time,
inside some
run_all_tests.sh
execute,
testDir/myTestA.sh
testDir/myTestB.sh
- if those other files contain only test functions then you could just source them in your master script,
source bash_test_tools
source myTestA.sh
source myTestB.sh
testrunner
Downside you would need to use same setup and teardown for all the tests, or just skip defining setup and teardown.
Maybe these suggestions are a bit clumsy. I'm sure it would be easy to improve these things.
Can you describe your particular use case better?
Is your goal to organize your tests better into separate files?
Should those files also be runnable?