monotone

monotone Mtn Source Tree

Root/notes/README.testing

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

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status