3 (in-package :it.bese.FiveAM)
5 (defclass testable-object ()
6 ((name :initarg :name :accessor name
7 :documentation "A symbol naming this test object.")
8 (description :initarg :description :accessor description :initform nil
9 :documentation "The textual description of this test object.")
10 (depends-on :initarg :depends-on :accessor depends-on :initform nil
11 :documentation "The list of AND, OR, NOT forms specifying when to run this test.")
12 (status :initarg :status :accessor status :initform :unknown
13 :documentation "A symbol specifying the current status
14 of this test. Either: T - this test (and all its
15 dependencies, have passed. NIL - this test
16 failed (either it failed or its dependecies weren't
17 met. :circular this test has a circular depenedency
19 (profiling-info :accessor profiling-info
21 :documentation "An object representing how
22 much time and memory where used by the
24 (collect-profiling-info :accessor collect-profiling-info
25 :initarg :collect-profiling-info
27 :documentation "When T profiling
28 information will be collected when the
31 (defmethod print-object ((test testable-object) stream)
32 (print-unreadable-object (test stream :type t :identity t)
33 (format stream "~S" (name test))))
35 (defclass test-suite (testable-object)
36 ((tests :accessor tests :initform (make-hash-table :test 'eql)
37 :documentation "The hash table mapping names to test
38 objects in this suite. The values in this hash table
39 can be either test-cases or other test-suites.")
40 (default-test-args :accessor default-test-args :initform '()
41 :initarg :default-test-args
42 :documentation "Arguments passed to TEST
43 macro when using this suite."))
44 (:documentation "A test suite is a collection of tests or test suites.
46 Test suites serve to organize tests into groups so that the
47 developer can chose to run some tests and not just one or
48 all. Like tests test suites have a name and a description.
50 Test suites, like tests, can be part of other test suites, this
51 allows the developer to create a hierarchy of tests where sub
52 trees can be singularly run.
54 Running a test suite has the effect of running every test (or
55 suite) in the suite."))
57 (defclass test-case (testable-object)
58 ((test-lambda :initarg :test-lambda :accessor test-lambda
59 :documentation "The function to run.")
60 (runtime-package :initarg :runtime-package :accessor runtime-package
61 :documentation "By default it stores *package* from the time this test was defined (macroexpanded)."))
62 (:documentation "A test case is a single, named, collection of
65 A test case is the smallest organizational element which can be
66 run individually. Every test case has a name, which is a symbol,
67 a description and a test lambda. The test lambda is a regular
68 funcall'able function which should use the various checking
69 macros to collect results.
71 Every test case is part of a suite, when a suite is not
72 explicitly specified (either via the :SUITE parameter to the TEST
73 macro or the global variable *SUITE*) the test is inserted into
74 the global suite named NIL.
76 Sometimes we want to run a certain test only if another test has
77 passed. FiveAM allows us to specify the ways in which one test is
80 - AND Run this test only if all the named tests passed.
82 - OR Run this test if at least one of the named tests passed.
84 - NOT Run this test only if another test has failed.
86 FiveAM considers a test to have passed if all the checks executed
87 were successful, otherwise we consider the test a failure.
89 When a test is not run due to it's dependencies having failed a
90 test-skipped result is added to the results."))
92 (defclass explainer ()
95 (defclass text-explainer (explainer)
98 (defclass simple-text-explainer (text-explainer)
101 (defclass detailed-text-explainer (text-explainer)
104 ;; Copyright (c) 2002-2003, Edward Marco Baringer
105 ;; All rights reserved.
107 ;; Redistribution and use in source and binary forms, with or without
108 ;; modification, are permitted provided that the following conditions are
111 ;; - Redistributions of source code must retain the above copyright
112 ;; notice, this list of conditions and the following disclaimer.
114 ;; - Redistributions in binary form must reproduce the above copyright
115 ;; notice, this list of conditions and the following disclaimer in the
116 ;; documentation and/or other materials provided with the distribution.
118 ;; - Neither the name of Edward Marco Baringer, nor BESE, nor the names
119 ;; of its contributors may be used to endorse or promote products
120 ;; derived from this software without specific prior written permission.
122 ;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
123 ;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
124 ;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
125 ;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
126 ;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
127 ;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
128 ;; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
129 ;; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
130 ;; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
131 ;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
132 ;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE