Changeset 974 for trunk/test/README

Dec 11, 2009, 5:33:48 AM (13 years ago)
Peter Johansson

extend list of tips when writing tests

1 edited


  • trunk/test/README

    r952 r974  
    6363  have fixed the bug.
     65  Add a copyright and license followed by one or two lines describing
     66  what the test does.
     68  Tests shall returns 0 at success, 77 if it should be skipped, and
     69  something else at failure. Tests should be silent also at failure
     70  unless option `-v` is passed or env variable VERBOSE is set.
     72  Add the test to XFAIL_TESTS in, if it tests a bug still
     73  present, i.e., the test is expected to fail.
     75C++ tests
    6578  Use the test::Suite class liberally. See other tests for examples of
    6679  typical usage.
    68   Tests shall return 0 at success and -1 otherwise (see
    69   test::Suite::return_value()). If the test should be skipped for some
    70   reason it shall return 77.
     81  Set `need_test_repo` to true in Suite constructor if the test uses
     82  the test repository. That will result in the test being skipped if
     83  test repo is not available, or if it is available the wc will
     84  checked out (if needed) and updated.
    72   When a test is run without verbose flag, it should be silent also at
    73   failure. Achieve this behaviour by sending output through
    74   test::Suite::out().
     86  Send output via test::Suite::out() which redirects the output to
     87  cout or /dev/null depending on whether VERBOSE and option `-v` are set.
    7689  If a test needs a data file, place the data in directory
    7992  VPATH build in which builddir and srcdir are not the same. To avoid
    8093  problems with files not found in VPATH builds, use the function
    81   test::filename() which gives you the absolute path to the file.
     94  test::src_filename() which gives you the absolute path to the
     95  file. If the data file is generated during build, e.g., checked out
     96  in a wc and residing in builddir, use test:filename instead.
     98  Add the test to check_PROGRAMS in
     100Shell tests
     103  Use `required=...` for setting a space delimited list of required
     104  tools (see other tests and If `repo` is included in
     105  `required`, a toy_project wc will be checked out and updated if test
     106  repo is available, otherwise test is skipped.
     108  Include, with `. ./`.
     110  Use variables set in such as $srcdir, $SVNDIGEST, and $SVN.
     112  Do not use `exit`, but use functions `exit_fail()`, `exit_skip()`,
     113  or `exit_success()`.
     115  Make sure to set svn property `svn:executable` on test.
     117  Add test to `distributed_TESTS` in
Note: See TracChangeset for help on using the changeset viewer.