Test Report Utility

Test Report Utility
SchemeStation documentation

1 Purpose

The purpose of this library is to give uniform interface to all test programs, and standardize the test report layout. There is also a script which analyses the library output files and calculates summary information.

2 Functionality

2.1 The library

The library consists of three functions and a macro:

Status tester_start(uchar *filename, uint32 flags);
Status tester_report(Bool success, uchar *msg, uint32 line,
		     uchar *file, uchar *module);
Status tester_end(void);
#define TESTER_REPORT(x, y, z) tester_report(x, y, __LINE__, __FILE__, z)

Use the tester_start() to initialize the library, TESTER_REPORT -macro to report success/failure (by the first boolean argument, True == success, False == failure) and at the end the tester_end() to finish testing.

The flags for the tester_start() function specify what the output should be generated. Normally this is set to TESTER_OUTPUT_REPORT.

The tester library records the following signals:

SIGILL
SIGABRT
SIGFPE
SIGSEGV
SIGTRAP
SIGBUS

2.2 Summary script

The summary script, test-summary.pl is an PERL-script, which calculates all successes and failures in each module, file -pair. Also, caught signals are calculated.

Script usage: test-summary

The summary information looks like this:

6 failures:
Module 'demo' file 'goom.c', 3
Module 'foobar' file 'goom.c', 1
4 successes:
Module 'demo' file 'goom.c', 4
Module 'foobar' file 'goom.c', 2
1 signals caught

3 Examples

3.1 Using the library

This is a simple test program to illustrate the use of the library:

#include "includes.h"
#include "debug.h"
#include "tester.h"

int main(int argc, char *argv[]) { if(STATUS_OK != tester_start("test.out", TESTER_OUTPUT_REPORT)) ASSERT(0);

TESTER_REPORT(True, "Hillo!", "test"); TESTER_REPORT(False, "Iiks!", "test");

tester_end();

return 0; }

The result of this program is a test report in file "test.out".

3.2 Report output

This is the output of the previous test program (file "test.out")

** Tester started Tue Jan 27 00:35:15 1998

Success in module 'test' - file 'goom.c', line 10 : Hillo! Failure in module 'test' - file 'goom.c', line 11 : Iiks!

** End time: Tue Jan 27 00:35:15 1998