os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/README
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 README -- Tcl test suite design document.
     2 
     3 RCS: @(#) $Id: README,v 1.11.2.1 2003/04/01 21:13:07 dgp Exp $
     4 
     5 Contents:
     6 ---------
     7 
     8     1. Introduction
     9     2. Running tests
    10     3. Adding tests
    11     4. Incompatibilities with prior Tcl versions
    12 
    13 1. Introduction:
    14 ----------------
    15 
    16 This directory contains a set of validation tests for the Tcl commands
    17 and C Library procedures for Tcl.  Each of the files whose name ends
    18 in ".test" is intended to fully exercise the functions in the C source
    19 file that corresponds to the file prefix.  The C functions and/or Tcl
    20 commands tested by a given file are listed in the first line of the
    21 file.
    22 
    23 2. Running tests:
    24 -----------------
    25 
    26 We recommend that you use the "test" target of Tcl's Makefile to run
    27 the test suite.  From the directory in which you build Tcl, simply
    28 type "make test".  This will create a special executable named
    29 tcltest in which the testing scripts will be evaluated.  To create
    30 the tcltest executable without running the test suite, simple type
    31 "make tcltest".
    32 
    33 All the configuration options of the tcltest package are available
    34 during a "make test" by defining the TESTFLAGS environment variable.
    35 For example,if you wish to run only those tests in the file append.test,
    36 you can type:
    37 
    38 	make test TESTFLAGS="-file append.test"
    39 
    40 For interactive testing, the Tcl Makefile provides the "runtest" target.
    41 Type "make runtest" in your build directory, and the tcltest executable
    42 will be created, if necessary, then it will run interactively.  At the
    43 command prompt, you may type any Tcl commands.  If you type
    44 "source ../tests/all.tcl", the test suite will run.  You may use the
    45 tcltest::configure command to configure the test suite run as an
    46 alternative to command line options via TESTFLAGS.  You might also
    47 wish to use the tcltest::testConstraint command to select the constraints
    48 that govern which tests are run.  See the documentation for the tcltest
    49 package for details.
    50 
    51 3. Adding tests:
    52 ----------------
    53 
    54 Please see the tcltest man page for more information regarding how to
    55 write and run tests.
    56 
    57 Please note that the all.tcl file will source your new test file if
    58 the filename matches the tests/*.test pattern (as it should).  The
    59 names of test files that contain regression (or glass-box) tests
    60 should correspond to the Tcl or C code file that they are testing.
    61 For example, the test file for the C file "tclCmdAH.c" is
    62 "cmdAH.test".  Test files that contain black-box tests may not
    63 correspond to any Tcl or C code file so they should match the pattern
    64 "*_bb.test". 
    65 
    66 Be sure your new test file can be run from any working directory.
    67 
    68 Be sure no temporary files are left behind by your test file.
    69 Use [tcltest::makeFile], [tcltest::removeFile], and [tcltest::cleanupTests]
    70 properly to be sure of this.
    71 
    72 Be sure your tests can run cross-platform in both a build environment
    73 as well as an installation environment.  If your test file contains
    74 tests that should not be run in one or more of those cases, please use
    75 the constraints mechanism to skip those tests.
    76 
    77 4. Incompatibilities of package tcltest 2.1 with 
    78    testing machinery of very old versions of Tcl:
    79 ------------------------------------------------
    80 
    81 1) Global variables such as VERBOSE, TESTS, and testConfig of the
    82    old machinery correspond to the [configure -verbose], 
    83    [configure -match], and [testConstraint] commands of tcltest 2.1,
    84    respectively.
    85 
    86 2) VERBOSE values were longer numeric.  [configure -verbose] values
    87    are lists of keywords.
    88 
    89 3) When you run "make test", the working dir for the test suite is now
    90    the one from which you called "make test", rather than the "tests"
    91    directory.  This change allows for both unix and windows test
    92    suites to be run simultaneously without interference with each
    93    other or with existing files.  All tests must now run independently
    94    of their working directory.
    95 
    96 4) The "all" file is now called "all.tcl"
    97 
    98 5) The "defs" and "defs.tcl" files no longer exist.
    99 
   100 6) Instead of creating a doAllTests file in the tests directory, to
   101    run all nonPortable tests, just use the "-constraints nonPortable"
   102    command line flag.  If you are running interactively, you can run
   103    [tcltest::testConstraint nonPortable 1] (after loading the tcltest
   104    package).
   105 
   106 7) Direct evaluation of the *.test files by the "source" command is no
   107    longer recommended.  Instead, "source all.tcl" and use the "-file" and
   108    "-notfile" options of tcltest::configure to control which *.test files
   109    are evaluated.