void FrontDeskOutputter::writeFailure(TestFailure& failure) { FrontDeskTestCase* test = (FrontDeskTestCase*) failure.failedTest(); m_stream << "\t<Failure>" << endl; m_stream << "\t\t<Name>" << clean(failure.toString()) << "</Name>" << endl; m_stream << "\t\t<Points>" << test->getFailPoints() << "</Points>" << endl; m_stream << "\t\t<Message>" << clean(failure.thrownException()->what()) << "</Message>" << endl; m_stream << "\t</Failure>" << endl; }
void FrontDeskOutputter::writeError(TestFailure& error) { FrontDeskTestCase* test = (FrontDeskTestCase*) error.failedTest(); m_stream << "\t<Error>" << endl; m_stream << "\t\t<Name>" << clean(error.toString()) << "</Name>" << endl; m_stream << "\t\t<Points>" << test->getErrorPoints() << "</Points>" << endl; m_stream << "\t\t<Message>" << clean(error.thrownException()->what()) << "</Message>" << endl; m_stream << "\t</Error>" << endl; }
void XmlOutputter::fillFailedTestsMap( FailedTests &failedTests ) { const TestResultCollector::TestFailures &failures = m_result->failures(); TestResultCollector::TestFailures::const_iterator itFailure = failures.begin(); while ( itFailure != failures.end() ) { TestFailure *failure = *itFailure++; failedTests.insert( std::pair<Test* const, TestFailure*>(failure->failedTest(), failure ) ); } }
void TextTestResult::printFailures(std::ostream& stream) { if (testFailures() != 0) { stream << "\n"; if (testFailures() == 1) stream << "There was " << testFailures() << " failure: " << std::endl; else stream << "There were " << testFailures() << " failures: " << std::endl; int i = 1; for (std::vector<TestFailure*>::iterator it = failures().begin(); it != failures().end(); ++it) { TestFailure* failure = *it; CppUnitException* e = failure->thrownException(); stream << std::setw(2) << i << ": " << failure->failedTest()->toString() << "\n" << " \"" << (e ? e->what() : "") << "\"\n" << " in \"" << (e ? e->fileName() : std::string()) << "\", line "; if (e == 0) { stream << "0"; } else { stream << e->lineNumber(); if (e->data2LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER) { stream << " data lines " << e->data1LineNumber() << ", " << e->data2LineNumber(); } else if (e->data1LineNumber() != CppUnitException::CPPUNIT_UNKNOWNLINENUMBER) { stream << " data line " << e->data1LineNumber(); } } stream << "\n"; i++; } } }