This is the cl-naive-tests Reference Manual, version 2023.12.10, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:11:40 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
cl-naive-tests
A test framework that is not based on any of the mainstream popular testing frameworks. It has a very simple api, so the learning curve should be considerably less than for most other frameworks. It is also designed to work well with gitlab CI.
Phil Marneweck <phil@psychedelic.co.za>
MIT
2023.12.10
cl-who
(system).
src/package.lisp
(file).
src/color.lisp
(file).
src/utility.lisp
(file).
src/naive-tests.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
cl-naive-tests/cl-naive-tests.asd
cl-naive-tests/src/package.lisp
cl-naive-tests/src/color.lisp
cl-naive-tests/src/utility.lisp
cl-naive-tests/src/naive-tests.lisp
cl-naive-tests/cl-naive-tests.asd
cl-naive-tests
(system).
cl-naive-tests/src/color.lisp
src/package.lisp
(file).
cl-naive-tests
(system).
*use-color*
(special variable).
*black*
(special variable).
*black-back*
(special variable).
*blink*
(special variable).
*blue*
(special variable).
*blue-back*
(special variable).
*bold*
(special variable).
*cyan*
(special variable).
*cyan-back*
(special variable).
*green*
(special variable).
*green-back*
(special variable).
*invert*
(special variable).
*magenta*
(special variable).
*magenta-back*
(special variable).
*no-blink*
(special variable).
*no-bold*
(special variable).
*no-invert*
(special variable).
*no-underline*
(special variable).
*normal*
(special variable).
*red*
(special variable).
*red-back*
(special variable).
*underline*
(special variable).
*white*
(special variable).
*white-back*
(special variable).
*yellow*
(special variable).
*yellow-back*
(special variable).
error-color
(function).
failure-color
(function).
normal-color
(function).
sgr
(function).
success-color
(function).
cl-naive-tests/src/utility.lisp
src/package.lisp
(file).
cl-naive-tests
(system).
ensure-list
(function).
hash-table-projection
(generic function).
cl-naive-tests/src/naive-tests.lisp
src/package.lisp
(file).
src/color.lisp
(file).
src/utility.lisp
(file).
cl-naive-tests
(system).
*debug*
(special variable).
*junit-no-properties*
(special variable).
*suites-results*
(special variable).
*test-suites*
(special variable).
*verbose*
(special variable).
calc-stats
(function).
create-suite
(generic function).
define-suite
(macro).
disable-testcase
(function).
disable-testcase
(condition).
find-testcase
(function).
format-results
(generic function).
report
(function).
run
(function).
save-results
(function).
setup-suite
(generic function).
skip-testcase
(function).
skip-testcase
(condition).
skip-testcase-reason
(reader method).
statistics
(function).
tear-down-suite
(generic function).
testcase
(macro).
testsuite
(macro).
testsuite-names
(function).
testsuite-selection
(function).
write-results
(function).
%run-suite
(function).
%testcase
(function).
*disabled-count*
(special variable).
*error-count*
(special variable).
*failure-count*
(special variable).
*skipped-count*
(special variable).
*suite-id*
(special variable).
*suite-name*
(special variable).
*suite-results*
(special variable).
*test-count*
(special variable).
*test-package*
(special variable).
*test-suite-names*
(special variable).
*testcase-results*
(special variable).
*testsuite-name*
(special variable).
call-with-test-error-handler
(function).
iso8601-time-stamp
(function).
junit-format-testcase
(function).
junit-format-testsuite
(function).
junit-format-testsuites
(function).
prepare-filename
(function).
prepare-testsuite-name
(function).
print-testcase-result
(function).
print-testsuites-results
(function).
readable-string
(function).
run-suite
(function).
run-suites-hashtable
(function).
run-suites-list
(function).
split-lines
(function).
with-test-error-handler
(macro).
Packages are listed by definition order.
cl-naive-tests
common-lisp
.
*debug*
(special variable).
*junit-no-properties*
(special variable).
*suites-results*
(special variable).
*test-suites*
(special variable).
*use-color*
(special variable).
*verbose*
(special variable).
calc-stats
(function).
create-suite
(generic function).
define-suite
(macro).
disable-testcase
(function).
disable-testcase
(condition).
find-testcase
(function).
format-results
(generic function).
report
(function).
run
(function).
save-results
(function).
setup-suite
(generic function).
skip-testcase
(function).
skip-testcase
(condition).
skip-testcase-reason
(generic reader).
statistics
(function).
tear-down-suite
(generic function).
testcase
(macro).
testsuite
(macro).
testsuite-names
(function).
testsuite-selection
(function).
write-results
(function).
%run-suite
(function).
%testcase
(function).
*black*
(special variable).
*black-back*
(special variable).
*blink*
(special variable).
*blue*
(special variable).
*blue-back*
(special variable).
*bold*
(special variable).
*cyan*
(special variable).
*cyan-back*
(special variable).
*disabled-count*
(special variable).
*error-count*
(special variable).
*failure-count*
(special variable).
*green*
(special variable).
*green-back*
(special variable).
*invert*
(special variable).
*magenta*
(special variable).
*magenta-back*
(special variable).
*no-blink*
(special variable).
*no-bold*
(special variable).
*no-invert*
(special variable).
*no-underline*
(special variable).
*normal*
(special variable).
*red*
(special variable).
*red-back*
(special variable).
*skipped-count*
(special variable).
*suite-id*
(special variable).
*suite-name*
(special variable).
*suite-results*
(special variable).
*test-count*
(special variable).
*test-package*
(special variable).
*test-suite-names*
(special variable).
*testcase-results*
(special variable).
*testsuite-name*
(special variable).
*underline*
(special variable).
*white*
(special variable).
*white-back*
(special variable).
*yellow*
(special variable).
*yellow-back*
(special variable).
call-with-test-error-handler
(function).
ensure-list
(function).
error-color
(function).
failure-color
(function).
hash-table-projection
(generic function).
iso8601-time-stamp
(function).
junit-format-testcase
(function).
junit-format-testsuite
(function).
junit-format-testsuites
(function).
normal-color
(function).
prepare-filename
(function).
prepare-testsuite-name
(function).
print-testcase-result
(function).
print-testsuites-results
(function).
readable-string
(function).
run-suite
(function).
run-suites-hashtable
(function).
run-suites-list
(function).
sgr
(function).
split-lines
(function).
success-color
(function).
with-test-error-handler
(macro).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Set to true to break into the debugger on errors.
The result of the last testsuites.
Tests are stored in here when registered.
When true, the success testcases are also printed.
Define a CREATE-SUITE method on the NAME (eql specializer),
to define the test suite at run-time.
The name of the test suite is registered immediately in
*TEST-SUITE-NAMES* for reference by RUN.
The TEST macro evaluates the ACTUAL expression and compare its result with the EXPECTED expression.
The comparison is done either with the TEST-FUNC if provided, with the
EQUAL function. If the comparison returns true, the test is
successful, otherwise it’s a failure. Test runs the test func
returning a plist with information about the result and test.
A plist containing the test info and results is returned. It should
be used in the lambda that is registered with register-test.
IDENTIFIER must be a symbol naming the testcase.
DISABLED is a generalized-boolean expression, evaluated. If the result
is true, then the test is marked disabled, and not run.
The ACTUAL code, or the TEST-FUNC code can also disable the testcase
by signaling a DISABLE-TESTCASE condition, or skip the testcase with a
message by signaling a SKIP-TESTCASE condition. (Functions are
provided to easily signal those conditions).
TEST-FUNC is the function that is run to determine the result of the
test. If none is supplied, then the EQUAL function is used to compare
the EXPECTED and the ACTUAL values. The TEST-FUNC returns a
failure-type: T or :SUCCESS in case of success, NIL or :FAILURE in
case of failure, or some other keyword if the test wasn’t run
successfully, but this shouldn’t be counted as a failure. The
TEST-FUNC is given two arguments: a plist containing :TEST-DATA
:EXPECTED :ACTUAL :EXPRESSION :ERROR, and the INFO. (:ACTUAL is the
value of the :EXPRESSION that is tested; if an error is signaled, it’s
passed in :ERROR).
TEST-DATA is a convenient place to store data the test relies on, this
can be used during the test and later in reporting on test results.
You can put what ever you want to in it.
INFO is a string to be read by the human that is digging into the
tests results, describing the test.
EXAMPLE:
(test (division non-zero-dividend)
:equal ’=
:expected 3/2
:actual (/ 3 2)
:info "Integer division by non-zero, giving a ratio.")
(test (division by-zero)
:test-func (lambda (result info)
(let ((actual (getf result :actual)))
(cond ((eql (getf result :expected)
:success)
((typep actual ’error)
(setf (aref (getf result :test-data) 0)
(list ’unexpected-error (type-of actual)))
:failure)
(t
(setf (aref (getf result :test-data) 0)
(list ’unexpected-result actual))
:failure))))
:test-data (vector nil)
:expected ’division-by-zero
:actual (handler-case (/ 3 0)
(:no-error (result) result)
(division-by-zero () ’division-by-zero)
(error (err) err))
:info "Integer division by zero, giving a DIVISION-BY-ZERO error.")
Defines a TESTSUITE.
The IDENTIFIER is a symbol identifying the testsuite.
The BODY is a list of lisp forms or TESTCASE forms.
The results of the TESTCASE are collected as results of the TESTSUITE.
Calculates stats. Stats are simple counts of tests, passed and failed per level.
Stats are stored in a hashtable per identifier level, which makes it easy to get to in format-results if needed.
Finds a result in the suites.
Reports on the pass or failure of the results set over all. This does not do any pretty printing etc because it needs to be machine readable. If you want pretty reporting look at format-results or do your own.
Runs all the testcases in all the SUITES passed in or all testsuites registered.
Statistics can be calculated during a test run, but the default is to use statistics after a test run to calculate stats.
Writes results to file. Formats the results using FORMAT-RESULT.
Can be used to calculate statistics post tests if *keep-stats-p* was nil.
Writes results to STREAM. Formats the results using FORMAT-RESULT.
Specialize to define test suite. This is run before a test is run. Was introduced so that test can be created in synq with setup-test code and any infrastructure created during setup-test.
Default method, does nothing.
Formats the results according to format.
The default method just outputs the results using lisp format string.
(eql :junit)
) suites) ¶Formats then results as Junit XML, junits only allows 3 levels nl. suites, suite and testcase. If your identifiers are not 1 or 3 levels this wont work for you.
(eql :text)
) suites-results) ¶Used to setup the multiverse, universe and other infrastructure for a test.
Implement the method to add any custom initialization.
Default does nothing.
skip-testcase
)) ¶This is run after an individual test, specialize to clean up any test infrastructure created by the setup-test or the tests them selves.
Default does nothing.
Current testsuite name.
The results of the last testsuite ran.
The current testcase results (plist).
The current testsuite name.
When VERBOSE is NIL don’t report the successes.
Returns a new hash-table containing the same values as in TABLE but only for the given keys. KEYS can be a list of keys, or a generalized boolean function called with key and value.
Jump to: | %
C D E F G H I J M N P R S T W |
---|
Jump to: | %
C D E F G H I J M N P R S T W |
---|
Jump to: | *
R S |
---|
Jump to: | *
R S |
---|
Jump to: | C D F P S |
---|
Jump to: | C D F P S |
---|