TestFailure

   
TestFailure

Description

The class TestFailure (see Figure C-22) summarizes the failure of a Test . The failure may be due to an assertion failure or an error. An error is defined as any exception that isn't an assertion failure.

TestFailure belongs to the namespace CppUnit . It is declared in TestFailure.h and is implemented in TestFailure.cpp .

Figure C-22. The class TestFailure
figs/utf_ac22.gif

Declaration

 class TestFailure 

Constructors/Destructors


TestFailure(Test *failedTest, Exception *thrownException, bool isError)

A constructor taking the Test that failed, the Exception that was thrown, and a flag indicating whether the failure was an assertion failure or an error.


virtual ~TestFailure( )

A destructor.

Public Methods


virtual TestFailure *clone( ) const

Returns a copy of this TestFailure .


virtual Test *failedTest( ) const

Returns the failed Test .


virtual string failedTestName( ) const

Returns the name of the failed Test .


virtual bool isError( ) const

Returns TRUE if the TestFailure is due to an error and not to an assertion failure.


virtual SourceLine sourceLine( ) const

Returns the SourceLine for this TestFailure .


virtual Exception *thrownException( ) const

Returns the Exception associated with this TestFailure .


virtual string toString( ) const

Returns a string representation of this TestFailure .

Protected/Private Methods


TestFailure(const TestFailure &other)

A copy constructor declared private to prevent its use.


TestFailure& operator=(const TestFailure& other)

A copy operator declared private to prevent its use.

Attributes


Test *m_failedTest

The failed Test ( protected ).


bool m_isError

Returns TRUE if the TestFailure is due to an error, FALSE if it is due to an assertion failure ( protected ).


Exception *m_thrownException

The Exception associated with this TestFailure ( protected ).



Unit Test Frameworks
Unit Test Frameworks
ISBN: 0596006896
EAN: 2147483647
Year: 2006
Pages: 146
Authors: Paul Hamill

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net