class TestSession

Interface representing the execution of a set of unit tests.

A test session is the observers viewpoint on the execution of a set of unit tests. It offers mostly query functions for the state of a test session and an operation for trying to cancel an ongoing session. This interface is used while interacting with instances of TestObserver. It is implemented by TestManager.



Public Members:
    virtual ~TestSession () ;
    Destructor.
    Enforces that derived classes have also a virtual constructor.

    virtual int noEncountered () const ;
    Returns the number of tests that were encountered in this session so far.
    The number of encountered test is the number of the executed tests plus the number of test that were skipped. Knowing number of encountered tests is particularly useful for progress reporting.

    virtual int noExecuted () const ;
    The number of executed tests.
    Equal to the number of succeeded and failed tests.

    virtual int noPassed () const ;
    The number of test that went fine.
    A test has passed successfully if it has not generated any exceptions.

    virtual int noFailed () const ;
    The number of test that generated a test failure or a test error.
    Note that this number is different from what is returned by noFailures and noErrors.

    virtual int noSkipped () const ;
    The number of test that were skipped.
    This is the number of test that were deliberately not executed.

    virtual int noFailures () const ;
    The number of test failures generated so far.
    This is the number of test failures, not the number of unsuccessful tests! (see also noFailed).

    virtual int noErrors () const ;
    The number of test errors encountered so far.
    Note that one test can generate two test errors! One error could come from a test action and another one from an erroneous test fixture tear-down.

    virtual vector<TestExceptionRecord*>& getTestExceptions () ;
    Returns the all test exceptions generated in this session so far.
    The returned vector must not be modified!

    virtual bool supportsCancel () const ;
    Check if cancelling a test session is possible.
    This function returns true when cancelling a test session is possible. It does not mean that calling cancel will be allways successful. I.e., this functions could be used when deciding if a stop button could be enabled or not.

    virtual bool tryCancel () ;
    Try to cancel the test session.
    With this function it could be tried to cancel an ongoing test session. The actual test performer could decide if it wants to cancel the session or continue running the session. In case the session is cancelled, true is returned. Calling this function only makes sense if supportsCancel returns true.

    virtual TestPhase getCurrentTestPhase () ;
    Inquires the current execution state of the actual test.
    This function tells the caller in which phase of a test execution the session is currently in.

    virtual time_t getStartTime () const ;
    Returns the start time of the session.
    The format of the return value is seconds since epoch, 01.01.1970, 00:00. The returned value is a "native OS time values", meaning that the time base (UTC or localised time) depends on the OS settings.

    virtual time_t getStopTime () const ;
    Returns the session stop time.
    See getStartTime for information about the time format and base.

    virtual void getRunTime (time_t& sec, long& usec) const ;
    Returns the run time of the test session.
    This is the real time clock difference between start and stop time. The parameter usec enhances the resolution up to microseconds. The real resolution of the usec value depends on the OS and is most likely considerably greater than one microsecond.




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