class SessionReport : StreamingObserver

Generates a final test report.

A test reporter is an observer that does its jobs after all the tests have been run. At the end of a test session, it generates a test report that lists all the test exceptions (failures and errors) which occurred during the session. Finally, a test session summary and the verdict, OK or FAILED, is logged.

The session report is designed so that it could be combined with a BriefSessionLog or a VerboseSessionLog.

See also observer output examples



Public Members:
    SessionReport ( ostream& stream, const string& title, bool sort = false, bool enabled = true, bool permitCancel = true ) ;
    Creates a test report observer.
    The title is printed at the beginning of the test session. If sort is true, all test exceptions are sorted before they are printed at the end of the test session. Session reports assign default options due to the following rule:
    If the report is enabled when this function is called, an option handler for the flag "-nr" (no report) is assigned. That disables the session report and consumes the flag.
    Otherwise, an file option handler for "-rf" (report file) is assigned, that sets the output file and consumes the flag.

    This behaviour allows to associate two session report observers to the test manager:

    • One that produces an screen output per default (enabled = true),
    • and another one that writes the report in a file on demand (enabled = false).


    virtual ~SessionReport () ;
    Destructor.
    Does nothing extra.

    virtual void beginSession (TestSession& session) ;
    A new session has been started.
    A header with the session title is generated and start, stop and run time are logged.

    virtual void endSession (TestSession& session, bool cancelled) ;
    The session has come to an end.
    All test exceptions, errors and failures, are printed (if any). If sorting is enabled, the list of exception is sorted before it is printed. A test session statistics is generated that summarises the test session outcome. Finally, the verdict of the session is printed.

    virtual void beginTest (Test& test, TestSession& session) ;
    A new test starts.
    Nothing is done.

    virtual void endTest (Test& test, TestSession& session, bool success) ;
    The test is finished.
    Nothing is done.

    virtual void testSkipped (Test& test, TestSession& session) ;
    A test was skipped.
    Nothing is done.

    virtual void logException (TestExceptionRecord& mr, TestSession& session) ;
    A test exception was thrown.
    Nothing is done. All test exceptions are summarized at the end of the session.




The Scrunitizer C++ Unit Test Framework
by Bernd Linowski

[Scrunitizer]  [Overview]  [Cookbook]  [Download]  [Index]  [Linosphere]

Page generated: 1 Nov 2000
(C) by Bernd Linowski
scrunitizer@linosphere.de