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
Testthat failed, theExceptionthat 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
TRUEif theTestFailureis due to an error and not to an assertion failure.-
virtual SourceLine sourceLine( ) const Returns the
SourceLinefor thisTestFailure.-
virtual Exception *thrownException( ) const Returns the
Exceptionassociated 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
