Package testing

Lightweight testing framework

Author

Damien Diederen  <dd@crosstwine.com>

Overview

Package testing (global prefix VedaTesting) provides support for automated testing of SKILL(++) packages. It is a port of the Go testing framework (http://golang.org/src/pkg/testing/testing.go) as provided by go1.0.2.

It is intended to select and automate the execution of any method of the form

(defmethod Test_Xxx ((context VedaTestingContext)) ...)

where Xxx can be any alphanumeric string (but the first letter must not be in [a-z]) and serves to identify the test routine. These Test_Xxx routines should be declared within the package they are testing, in files ending in -test.il or -test.ils.

This package does not yet implement the BenchmarkXxx or Example{F,T,T_M} features of the Go testing package.

Index

Class VedaTestingContext
Method VedaTestingError ((context VedaTestingContext) @rest args)
Method VedaTestingErrorf ((context VedaTestingContext) format @rest args)
Method VedaTestingFail ((context VedaTestingContext))
Method VedaTestingFailNow ((context VedaTestingContext))
Method VedaTestingFatal ((context VedaTestingContext) @rest args)
Method VedaTestingFatalf ((context VedaTestingContext) format @rest args)
Method VedaTestingLog ((context VedaTestingContext) @rest args)
Method VedaTestingLogf ((context VedaTestingContext) format @rest args)
Function VedaTestingRunTests (tests @key options)
Function VedaTestingRunTestsFromFiles (files @key options)
Function VedaTestingRunTestsOnPackage (pkg @key options)

Package files

testing.ils

Details

Class VedaTestingContext

(defclass VedaTestingContext () ...)

Context instances are passed to Test methods to manage test state and support test logs. Logs are accumulated during execution and dumped to a file or standard output depending on configuration options.

Method VedaTestingError

(defmethod VedaTestingError ((context VedaTestingContext) @rest args) ...)

Error is equivalent to (Log) followed by (Fail).

Method VedaTestingErrorf

(defmethod VedaTestingErrorf ((context VedaTestingContext) format @rest args) ...)

Errorf is equivalent to (Logf) followed by (Fail).

Method VedaTestingFail

(defmethod VedaTestingFail ((context VedaTestingContext)) ...)

Fail marks the function as having failed but continues execution.

Method VedaTestingFailNow

(defmethod VedaTestingFailNow ((context VedaTestingContext)) ...)

FailNow marks the function as having failed and stops its execution. Execution will continue at the next test or benchmark.

Method VedaTestingFatal

(defmethod VedaTestingFatal ((context VedaTestingContext) @rest args) ...)

Fatal is equivalent to (Log) followed by (FailNow).

Method VedaTestingFatalf

(defmethod VedaTestingFatalf ((context VedaTestingContext) format @rest args) ...)

Fatalf is equivalent to (Logf) followed by (FailNow).

Method VedaTestingLog

(defmethod VedaTestingLog ((context VedaTestingContext) @rest args) ...)

Log formats its arguments using default formatting, and records the text in the error log.

Method VedaTestingLogf

(defmethod VedaTestingLogf ((context VedaTestingContext) format @rest args) ...)

Logf formats its arguments according to the format, analogous to printf, and records the text in the error log.

Function VedaTestingRunTests (exported)

(defun RunTests (tests @key options) ...)

RunTests runs the test functions in tests, a list of funcallable symbols, and generates reports according to the provided options.

Function VedaTestingRunTestsFromFiles (exported)

(defun RunTestsFromFiles (files @key options) ...)

RunTestsFromFiles loads files in-order while monitoring the set of methods having the form

(defmethod Test_Xxx ((context VedaTestingContext)) ...)

then executes the newly-defined/redefined ones.

Function VedaTestingRunTestsOnPackage (exported)

(defun RunTestsOnPackage (pkg @key options) ...)

RunTestsOnPackage finds the set of source and test files associated with package pkg, reloads all the source files, then loads and runs all the tests contained in the test files.