void XmlOutputter::addFailureLocation( TestFailure *failure, XmlElement *testElement ) { XmlElement *locationNode = new XmlElement( "Location" ); testElement->addElement( locationNode ); SourceLine sourceLine = failure->sourceLine(); locationNode->addElement( new XmlElement( "File", sourceLine.fileName() ) ); locationNode->addElement( new XmlElement( "Line", sourceLine.lineNumber() ) ); }
void XmlOutputter::addStatistics( XmlElement *rootNode ) { XmlElement *statisticsElement = new XmlElement( "Statistics" ); rootNode->addElement( statisticsElement ); statisticsElement->addElement( new XmlElement( "Tests", m_result->runTests() ) ); statisticsElement->addElement( new XmlElement( "FailuresTotal", m_result->testFailuresTotal() ) ); statisticsElement->addElement( new XmlElement( "Errors", m_result->testErrors() ) ); statisticsElement->addElement( new XmlElement( "Failures", m_result->testFailures() ) ); for ( Hooks::iterator it = m_hooks.begin(); it != m_hooks.end(); ++it ) (*it)->statisticsAdded( m_xml, statisticsElement ); }
void XmlOutputter::addSuccessfulTest( Test *test, int testNumber, XmlElement *testsNode ) { XmlElement *testElement = new XmlElement( "Test" ); testsNode->addElement( testElement ); testElement->addAttribute( "id", testNumber ); testElement->addElement( new XmlElement( "Name", test->getName() ) ); for ( Hooks::iterator it = m_hooks.begin(); it != m_hooks.end(); ++it ) (*it)->successfulTestAdded( m_xml, testElement, test ); }
void XmlOutputter::addFailedTest( Test *test, TestFailure *failure, int testNumber, XmlElement *testsNode ) { Exception *thrownException = failure->thrownException(); XmlElement *testElement = new XmlElement( "FailedTest" ); testsNode->addElement( testElement ); testElement->addAttribute( "id", testNumber ); testElement->addElement( new XmlElement( "Name", test->getName() ) ); testElement->addElement( new XmlElement( "FailureType", failure->isError() ? "Error" : "Assertion" ) ); if ( failure->sourceLine().isValid() ) addFailureLocation( failure, testElement ); testElement->addElement( new XmlElement( "Message", thrownException->what() ) ); for ( Hooks::iterator it = m_hooks.begin(); it != m_hooks.end(); ++it ) (*it)->failTestAdded( m_xml, testElement, test, failure ); }