1. Introduction
  2. Test Results Object Procedures
    1. Usage
    2. Parameters
      1. default-test-file-extension
      2. test-files-directory
      3. test-results-directory
    3. Reader Extensions
      1. load-test-results-reader-extension
      2. test-results-reader-setup
    4. Pathname Constructors
      1. make-test-file-pathname
      2. make-test-results-pathname
    5. Test Results File Procedures
      1. create-test-results-file
      2. delete-test-results-file
      3. read-test-results-file
      4. append-test-results-row
    6. Test Results Port Procedures
      1. read-test-results-rows
  3. Test Results File Entry Procedures
    1. make-test-results-row
    2. test-results-row-field
    3. test-results-row-when
    4. test-results-row-results
  4. Test Results Procedures
    1. test-results-failures
    2. test-results-remove!
  5. Test Result Object
    1. Test Result Fields
      1. Test Types - type field
      2. Test Kinds - possible kind field for type
      3. Other Fields
    2. Test Result Procedures
      1. make-test-abnormal-exit-result
      2. test-result-field
      3. test-result-fields
      4. test-result-finding
      5. test-result-identifier
      6. test-result-passed?
      7. test-result-type
  6. Test Results Report Procedures
    1. Usage
      1. test-results-row-match?
      2. declare-test-results-row-field
      3. print-test-result
      4. print-test-results
      5. print-test-results-row
      6. print-test-results-rows
      7. print-test-results-file
  7. Requirements
  8. Authors
  9. License
  10. Version History
  11. Bugs

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)

test-results-reader-setup

[procedure] (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 [FOLD-PROCEDURE [INITIAL-VALUE]])

Reads the contents of the test results file FILENAME and returns the last result of calling the FOLD-PROCEDURE. If necessary an absolute pathname will be constructed using the current parameters.

FOLD-PROCEDURE is a two argument procedure where the first argument is the current row and the second argument is the result of the previous call. The initial second argument is the empty list, '().

Default FOLD-PROCEDURE is cons.

Default INITIAL-VALUE is '().

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.

Test Results Port Procedures

read-test-results-rows

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

Reads the contents of the test results file from the open input PORT and calls the FOLD-PROCEDURE on each row and the accumulated result.

FOLD-PROCEDURE is a two argument procedure where the first argument is the current row and the second argument is the result of the previous call. The initial second argument is the empty list, '().

Default FOLD-PROCEDURE is cons.

Default INITIAL-VALUE is '().

Test Results File Entry Procedures

make-test-results-row

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

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

A FIELD is a pair of (KEY . VALUE).

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-when

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

Returns the test results file entry ROW when field, a vector as returned by seconds->local-time.

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)

test-results-row-match?

[procedure] (test-results-row-match? ROW [KEY OPER VAL] ...)

Returns #t when all match expressions KEY OPER VAL are true, and #f otherwise. Operates as if there is an implicit AND between each match expression.

KEY is a symbol. A test-results-row field name.

OPER is one of = < > <= >= <>.

VAL is some object of the proper type for the test-results-row field.

declare-test-results-row-field

[procedure] (declare-test-results-row-field [KEY PRED COMP] ...)

Sets the type predicate PRED & comparison function COMP for the test-results-row field named KEY.

KEY is a symbol.

PRED is single-argument function returning #t when OBJECT is of the correct type, and #f otherwise.

COMP is a two-argument function returning a negative fixnum for A < B, zero fixnum for A = B, and positive fixnum for A > B.

when
ten-element time-vector, using #f for missing element.
model
symbol, compile or interpret.
mode
symbol, all or errors.
feature
list of symbol, a module-identifier.
purpose
list. Cannot be matched.
results
list. Cannot be matched.

The time-vector comparison checks the three-element time & three-element date components. Either must be complete (no #f elements) for a valid comparison.

Comparisons are case-sensitive.

[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 [KEY OPER VAL] ...)

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

[procedure] (print-test-results-rows ROWS [KEY OPER VAL] ...)

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

[procedure] (print-test-results-file FILENAME [KEY OPER VAL] ...)

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, 2008 Kon Lovett. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version History

2.1.0
Removed 'knd' parameter from 'make-test-results-row'. Removed 'test-results-row-model' Added 'declare-test-results-row-field' & 'test-results-row-match?'.
2.0.0
Removed 'fold-test-results-rows' & added optional folding paramters to 'read-test-results-rows' & 'read-test-results-file'.
1.1
Split out print procedures into own file
1.0
Initial release

Bugs