STestReporter Class Reference

A class that logs test case results and prints then when the script finishes. More...

Inheritance diagram for STestReporter:

Inheritance graph
[legend]

List of all members.

Static Public Member Functions

static init ()
 Initialize the STestReporter.
static printTestReport ()
 Print out the test report XML.
static register ($key, $value)
 Register a key/value pair to report as part of the test suite.
static registerErrors ()
 Register the errors from SErrorManager with this class.
static registerStatus ($status)
 Register a status for this test case run.
static renderTestSuiteReport ($data)
 Render the test suite report as an XML string to print on the page.
static statusToString ($status)
 Return a text string representing a given page status.

Static Protected Member Functions

static renderTestSuiteReportRec ($data)
 A recursive helper function to render test suite reports.


Detailed Description

A class that logs test case results and prints then when the script finishes.

This class is activated when the runTestSuite GET variable is set. Controllers, frameworks, etc. can log test values by name with this class. When the script shuts down, this class reports all results as a commented XML string printed at the end of the page. The XML string can then be scraped and parsed by a reporting tool such as STestDispatcher.

Date:
2/16/09
Author:
jwsm@shodor.org

Member Function Documentation

static STestReporter::init (  )  [static]

Initialize the STestReporter.

If the 'runTestSuite' param is set, Register a shutdown function to print test report data, set our reporting status to true, and our return status to OK.

static STestReporter::register ( key,
value 
) [static]

Register a key/value pair to report as part of the test suite.

Register a test value by name with the reporter. All values will be reported in the XML string returned when the reporter is running.

Parameters:
$key [string]: The name of the test value being reported
$value [string]: The value being reported

static STestReporter::registerErrors (  )  [static]

Register the errors from SErrorManager with this class.

This function is called right before the test report is printed out

static STestReporter::registerStatus ( status  )  [static]

Register a status for this test case run.

If the newly passed status level is higher (OK < Warning < Error) than the current level, the new level will replace the old. Once a status level is achieved, the status will never go back down due to a new status registration.

Parameters:
$status [int]: A status code constant

static STestReporter::renderTestSuiteReport ( data  )  [static]

Render the test suite report as an XML string to print on the page.

This XML string will be printed within a comment at the bottom of any common-generated page if the 'runTestSuite' param is passed to $_GET.

Parameters:
$data [array]: The set of test values to be reported to the test dispatcher via XML

static STestReporter::statusToString ( status  )  [static]

Return a text string representing a given page status.

Generate a string representation of the report's status (page error level)

Parameters:
$status [int]: A status code constant
Returns:
[string]: A text representation of the status


The documentation for this class was generated from the following file:

Generated on Wed Nov 24 02:03:36 2010 for Common by  doxygen 1.5.6