my-utility-test.sh
A test-plan is a simple shell script that contains tests. Tests are functions whose
names are prefixed with it_
.
Roundup will extract these function names and run them in a sandbox. Each test is run in its own sandbox to prevent false positives.
Example:
describe "My Utility"
it_displays_usage() {
usage=$(./my-utility | head -n 1)
test "$usage" = "usage: my-utility [arg1 ... argN]"
}
The describe
function is defined in your sandbox as a convenient way to
give the test-plan a more meaningful name than the default.
When setup and tear-down are needed, create a before
and/or after
function.
They are run before and after each test in the plan. These are useful for
cleaning up the file system or any environmental changes that may trip up
tests.
For a complete working example, see roundup-5-test.sh and roundup-1-test.sh
There will be bugs. Please report them at here
Blake Mizerany (http://blakemizerany.com/about)
(c) 2010 Blake Mizerany
roundup
is licenced under the MIT open-source licence.
roundup(5), test(1)
Contest - http://blog.citrusbyte.com/2009/05/19/introducing-contest
Unit Testing - http://en.wikipedia.org/wiki/Unit_testing
Behaviour Driven Development - http://behaviour-driven.org/Introduction