Creates a testsuite named
testsuite-name and, optionally, the code required for test setup, test tear-down and the actual test-cases. A testsuite is a collection of test-cases and other testsuites.
Test suites can have multiple superclasses (just like the classes that they are). Usually, these will be other test classes and the class hierarchy becomes the test case hierarchy. If necessary, however, non-testsuite classes can also be used as superclasses.
Slots are specified as in defclass with the following additions:
* Initargs and accessors are automatically defined. If a slot is named
my-slot, then the initarg will be
:my-slot and the accessors will be
* If the second argument is not a CLOS slot option keyword, then it will be used as the
:initform for the slot. I.e., if you have
(deftestsuite my-test ()
my-slot will be initialized to 23 during test setup.
Test options are one of :setup, :teardown, :test, :tests, :documentation, :export-p, :dynamic-variables, :export-slots, :function, :categories, :run-setup, or :equality-test.
* :categories - a list of symbols. Categories allow you to groups tests into clusters outside of the basic hierarchy. This provides finer grained control on selecting which tests to run. May be specified multiple times.
* :documentation - a string specifying any documentation for the test. Should only be specified once.
* :dynamic-variables - a list of atoms or pairs of the form (name value). These specify any special variables that should be bound in a let around the body of the test. The name should be symbol designating a special variable. The value (if supplied) will be bound to the variable. If the value is not supplied, the variable will be bound to nil. Should only be specified once.
* :equality-test - the name of the function to be used by default in calls to ensure-same and ensure-different. Should only be supplied once.
* :export-p - If true, the testsuite name will be exported from the current package. Should only be specified once.
* :export-slots - if true, any slots specified in the test suite will be exported from the current package. Should only be specified once.
* :function - creates a locally accessible function for this test suite. May be specified multiple times.
* :run-setup - specify when to run the setup code for this test suite. Allowed values are
* :once-per-test-case or t (the default)
* :never or nil
:run-setup is handy when a testsuite has a time consuming setup phase that you do not want to repeat for every test.
* :setup - a list of forms to be evaluated before each test case is run. Should only be specified once.
* :teardown - a list of forms to be evaluated after each test case is run. Should only be specified once.
* :test - Define a single test case. Can be specified multiple times.
* :tests - Define multiple test cases for this test suite. Can be specified multiple times.