I create a one module of tests for each module of code. If the module
is called foo
the test module is called foo-test
and
exports a single test suite, called foo-tests
. For each project
(or collection) called, say, bar
I have a single module
all-bar-tests
that exports a single test suite (called
all-bar-tests
) which collects together all the test suites for
that project. I often create another file, called run-tests.ss
which runs all-bar-tests
using the text user interface. To run
all the project's tests I can then simply execute run-test.ss
in
Dr/MzScheme.
Defining your own assertions is one of the most powerful features of
SchemeUnit. Whenever you find yourself writing out the same series of
assertions define your own assertion and that instead. Your
assertions will act just like the pre-defined assertions; they take
optional message strings and will display locations and parameters.
They are really easy to create as well. For instance, to define an
assertion called assert-is-2
that asserts a value is equal to 2,
you'd just evaluate
(define-assertion (assert-is-2 x) (= x 2))
If you find you're creating a library of assertions please submit them to us so we can share them with all SchemeUnit users.