Name
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.
Declaration
class TestFailure
Constructors/Destructors
-
TestFailure(Test *failedTest, Exception *thrownException, bool isError)
A constructor taking the
Test
that failed, theException
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 theTestFailure
is due to an error and not to an assertion failure.-
virtual SourceLine sourceLine( ) const
Returns the
SourceLine
for thisTestFailure
.-
virtual Exception *thrownException( ) const
Returns the
Exception
associated with thisTestFailure
.-
virtual string toString( ) const
Returns a string representation of this
TestFailure
.
Protected/Private Methods
-
TestFailure(const TestFailure &other)
A copy constructor declared
private ...
Get Unit Test Frameworks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.