You are looking at historical revision 4131 of this page. It may differ significantly from its current revision.

Introduction

TestBase test results database access procedures.

Test Results Object Procedures

Usage

(require-extension testbase-results)

Parameters

default-test-file-extension

[parameter] (default-test-file-extension [EXTENSION])

Get or set the test file source filename extension. EXTENSION is a string.

test-files-directory

[parameter] (test-files-directory [DIRECTORY])

Get or set the test file source repository directory. DIRECTORY is an absolute directory pathname string.

test-results-directory

[parameter] (test-results-directory [DIRECTORY])

Get or set the test file results repository directory. DIRECTORY is an absolute directory pathname string.

Reader Extensions

load-test-results-reader-extension

[procedure] (load-test-results-reader-extension EXTENSIONS)

run-test-results-reader-setup

[procedure] (run-test-results-reader-setup EXPRESSIONS)

Pathname Constructors

make-test-file-pathname

[procedure] (make-test-file-pathname FILENAME)

Returns an absolute pathname of a test file for FILENAME.

make-test-results-pathname

[procedure] (make-test-results-pathname FILENAME)

Returns an absolute pathname of a results file for FILENAME.

Test Results File Procedures

create-test-results-file

[procedure] (create-test-results-file FILENAME)

Creates a test results file FILENAME. If necessary an absolute pathname will be constructed using the current parameters.

delete-test-results-file

[procedure] (delete-test-results-file FILENAME)

Deletes the test results file FILENAME. If necessary an absolute pathname will be constructed using the current parameters.

read-test-results-file

[procedure] (read-test-results-file FILENAME)

Reads the contents of the test results file FILENAME and returns a list. If necessary an absolute pathname will be constructed using the current parameters.

read-test-results-rows

[procedure] (read-test-results-rows PORT)

Reads the contents of the test results file from the open input PORT and returns a list.

append-test-results-row

[procedure] (append-test-results-row FILENAME ROW [HEADER '()])

Write the test results file entry ROW to the test results file FILENAME, with the optional HEADER. If necessary an absolute pathname will be constructed using the current parameters.

The HEADER is a list of key+value pairs where the key is a symbol. The only recognized header entries are extension and setup.

fold-test-results-rows

[procedure] (fold-test-results-rows FOLD-PROCEDURE INITIAL-VALUE PORT)

Calls the FOLD-PROCEDURE for every test results file entry from the open input PORT, passing the current entry and the result of last call, or the INITIAL-VALUE when the first call.

Test Results File Entry Procedures

make-test-results-row

[procedure] (make-test-results-row knd RESULTS . FIELDS)

Returns a test results file entry for the test results RESULTS and the optional FIELDS.

test-results-row-field

[procedure] (test-results-row-field ROW KEY)

Returns the test results file entry ROW field of the given name KEY.

test-results-row-model

[procedure] (test-results-row-model ROW)

Returns the test results file entry ROW model field, a string.

test-results-row-when

[procedure] (test-results-row-when ROW)

Returns the test results file entry ROW when field, a vector.

test-results-row-results

[procedure] (test-results-row-results ROW)

Returns the test results file entry ROW results field, a list.

Test Results Procedures

test-results-failures

[procedure] (test-results-failures RESULTS [TYPE-LIST '(expectation error)])

Returns a list of the test failures in the RESULTS list for the given test types TYPE-LIST.

See Test Result Fields in the Test Result Object section.

test-results-remove!

[procedure] (test-results-remove! RESULTS IDENTIFIER-LIST)

Returns the RESULTS list with all tests from the IDENTIFIER-LIST removed.

Test Result Object

Test Result Fields

Test Types - type field

begin
Begin a test container
end
End a test container
expectation
Single test
error
Test terminated
annotation
Messages from the test

Test Kinds - possible kind field for type

begin, end
test-procedure, test-suite, test-case
annotation
gloss, todo, skip
error
message
expectation
The kind suffix for a expectation. Example - 'expect-foo' is 'foo'

Other Fields

Object refers to any Scheme object. Atomic means boolean, number, string, symbol.

id
Test unique Id. A symbol.
name
Given test name. Atomic, but usually a string. Optional.
warning
Test warning notice. Object, but usually a string. Optional.
message
Test notice. Object, but usually a string. Optional.
finding
Test result. Object, but usually a boolean.
unevaluated
Expectation form to test. Object. Optional.
expected
Expectation test expected result. Object. Optional.
actual
Expectation evaluated form result. Object. Optional.
tolerance
Fuzzy expectation allowable difference. Object, but usually number. Optional.
container
Kind of test container. A symbol.
location
A test identifier (name or id). Atomic, but usually a string or symbol.

Test Result Procedures

make-test-abnormal-exit-result

[procedure] (make-test-abnormal-exit-result EXIT-CODE ERROR-STRING)

Returns a test result object that indicates a test process failed. Really only for use by a test runner.

test-result-field

[procedure] (test-result-field RESULT KEY)

Returns the test result RESULT field of the given name KEY.

test-result-fields

[procedure] (test-result-fields RESULT [KEY ...])

Returns the test result RESULT fields of the given name KEY as a list.

test-result-finding

[procedure] (test-result-finding RESULT)

Returns the test result RESULT finding field, which could be any object but usually a boolean. Since any object is possible use the test-result-passed? procedure to determine whether the test passed.

test-result-identifier

[procedure] (test-result-identifier RESULT)

Returns the test result RESULT name, message, or id field, which could be any object but usually a string or symbol. The id field is returned when the name is missing.

test-result-passed?

[procedure] (test-result-passed? RESULT)

Does the test result RESULT finding field indicate this test passed?

test-result-type

[procedure] (test-result-type RESULT)

Returns the test result RESULT type field, a symbol.

Test Results Report Procedures

Usage

(require-extension testbase-reports)

[procedure] (print-test-result RESULT)

Print the test result RESULT to the current output port.

[procedure] (print-test-results RESULTS)

Print the test results list RESULTS to the current output port.

[procedure] (print-test-results-row ROW)

Print the test results file entry ROW to the current output port.

[procedure] (print-test-results-rows ROWS)

Print the test results file entry list ROWS to the current output port.

[procedure] (print-test-results-file FILENAME)

Print the test results file FILENAME to the current output port. If necessary an absolute pathname will be constructed using the current parameters.

Requirements

numbers misc-extn miscmacros testbase

Authors

Kon Lovett

License

Copyright (c) 2007 Kon Lovett

Open Source

Version History

1.1
Split out print procedures into own file
1.0
Initial release

Bugs