* Taylor R. Campbell's Simple Testing Utility for Scheme -*-outline-*-
This is a simple, portable testing utility for Scheme. It makes no
pretenses to be a comprehensive framework for building complex test
suites; it is merely a simple tool to express simple test suites, which
requires very little cognitive overhead.
The procedure of loading this utility depends on what Scheme system you
are using. See Section `Porting' for details.
The file COPYING in this directory contains the GNU General Public
License. The file COPYING.LESSER contains the supplements to the GNU
General Public License that constitute the GNU Lesser General Public
License.
** Copying
Copyright (C) 2007, 2009 Taylor R. Campbell.
This file is part of TRC-Testing.
TRC-Testing is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
TRC-Testing is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with TRC-Testing. If not, see
.
** Documentation
Definitions:
- A /test/ is either a test case or a test suite.
- /Test cases/ are individual tests, consisting of an optional setup
action, a list of actions to conduct the test, and an optional
teardown action.
- /Test suites/ are collections of tests.
There is a procedural interface for operating on tests, described
later; of immediate interest is only the (RUN-TEST ) procedure,
which runs . Running a test case has the effect of, for each
action in the test, dynamically winding the setup action, the test
action, and the teardown action. Running a test suite has the effect
of running all of its collected tests.
Typically, the tests for a component of a program are isolated in a
file containing test suite and test case definitions, using the
following macros to write tests.
*** Test Description Macros
(DEFINE-TEST-SUITE ) ;syntax
Defines to be a test suite with the given description and no
child tests.
(DEFINE-TEST-SUITE () ) ;syntax
Defines to be a test suite with the given description and no
child tests, and adds the new test suite to the end of the list of
's children.
(DEFINE-TEST-CASE ) ;syntax
Adds under the name to . is
evaluated, and is usually a TEST-CASE expression (see below). This
form is useful for defining test cases that have local variables that
must be initialized and deinitialized by the setup and teardown
actions; for example,
(define-test-case mumble-tests foo
(let ((socket #f))
(test-case foo
((setup (set! socket (create-socket ...)))
(teardown (close-socket socket) (set! socket #f)))
...))).
(DEFINE-TEST-CASE (