BeakerLib unit tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a set of unit tests used for BeakerLib sanity checking.
Should be run during package building and before submitting a
patch. Some of the tests are expected to fail (backup functions
need root permission and the coverage test suite fails because...
well because the coverage is not complete... yet :-)
How to run tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All available tests: ./test.sh
Selected files only: ./test.sh beakerlibTest.sh ...
Selected tests only: ./test.sh test_rlServiceStart ...
Check test.sh sanity: ./test.sh test
For more detailed output & logging use: DEBUG=1 ./test.sh ...
How to add a test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Just create a "*Test.sh" file, which contains functions named
"test_*" which use any of the following asserts:
assertRun command [status] [comment]
* run the command
* check its exit status
* log the result with a comment
assertTrue comment command
* check that command succeeded (status 0)
assertFalse comment command
* check that command failed (status 1)
assertGoodBad command good bad
* run the command
* check that correct asserts are saved into journal
* specify number of expected good/bad asserts, "" to skip
assertParameters assert
* check that missing parameters are reported
* removes parameters from assert call - must not pass
* works only for assert (checks journal, not the exit code)
The tests should not produce any output unless DEBUG=1 specified
and should clean up after themselves when finished. The expected
status for the assertRun command can also be a regular expression.