1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
HOWTO make tests
================
Quick and dirty howto, to get you up to create and run tests.
Very early draft. Feel free to improve.
Running tests:
--------------
- Starting in the monotone main dir. After having './configure'd monotone you
can do 'make tester' to create 'tester', the program that runs the tests.
Running './testsuite.lua' (or './tester testsuite.lua') will run all tests.
- 'testsuite.lua -l' lists the names and numbers of all available tests
- 'testsuite.lua <n>' runs only test number n, negative n counts from the end
- 'testsuite.lua foobar' runs tests with "foobar" in the name
(it's actually a regex)
- option -d will keep the tester_dir files for post-test debugging
- option -h is your friend :)
- summary of test logs in tester_dir/tester.log
- details of test logs in tester_dir/<testname>/tester.log
Creating tests:
---------------
- Copy and paste is your friend :)
- Make a new directory tests/<testname>
- Add a line for <testname> at the end of testsuite.lua
- TODO: need more here...
- Sometimes you need to canonicalize things
Template for a test (name tests/<testname>/__driver__.lua:
------------------------------------------------
-- Initialize our workspace
mtn_setup()
-- run monotone
-- we want return value 0
-- we want to save the standard output in file "stdout"
-- we want to ignore the standard error
check(mtn("ls", "unknown"), 0, true, false)
-- we want "mtn foobar" to work, but since we know it doesn't
-- we tell the test program that this is expected to fail
xfail_if(true, mtn("foobar"), 0)
|