| 4247 | } |
| 4248 | |
| 4249 | void XmlUnitTestResultPrinter::OutputXmlTestResult(::std::ostream* stream, |
| 4250 | const TestResult& result) { |
| 4251 | int failures = 0; |
| 4252 | int skips = 0; |
| 4253 | for (int i = 0; i < result.total_part_count(); ++i) { |
| 4254 | const TestPartResult& part = result.GetTestPartResult(i); |
| 4255 | if (part.failed()) { |
| 4256 | if (++failures == 1 && skips == 0) { |
| 4257 | *stream << ">\n"; |
| 4258 | } |
| 4259 | const std::string location = |
| 4260 | internal::FormatCompilerIndependentFileLocation(part.file_name(), |
| 4261 | part.line_number()); |
| 4262 | const std::string summary = location + "\n" + part.summary(); |
| 4263 | *stream << " <failure message=\"" << EscapeXmlAttribute(summary) |
| 4264 | << "\" type=\"\">"; |
| 4265 | const std::string detail = location + "\n" + part.message(); |
| 4266 | OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str()); |
| 4267 | *stream << "</failure>\n"; |
| 4268 | } else if (part.skipped()) { |
| 4269 | if (++skips == 1 && failures == 0) { |
| 4270 | *stream << ">\n"; |
| 4271 | } |
| 4272 | const std::string location = |
| 4273 | internal::FormatCompilerIndependentFileLocation(part.file_name(), |
| 4274 | part.line_number()); |
| 4275 | const std::string summary = location + "\n" + part.summary(); |
| 4276 | *stream << " <skipped message=\"" |
| 4277 | << EscapeXmlAttribute(summary.c_str()) << "\">"; |
| 4278 | const std::string detail = location + "\n" + part.message(); |
| 4279 | OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str()); |
| 4280 | *stream << "</skipped>\n"; |
| 4281 | } |
| 4282 | } |
| 4283 | |
| 4284 | if (failures == 0 && skips == 0 && result.test_property_count() == 0) { |
| 4285 | *stream << " />\n"; |
| 4286 | } else { |
| 4287 | if (failures == 0 && skips == 0) { |
| 4288 | *stream << ">\n"; |
| 4289 | } |
| 4290 | OutputXmlTestProperties(stream, result); |
| 4291 | *stream << " </testcase>\n"; |
| 4292 | } |
| 4293 | } |
| 4294 | |
| 4295 | // Prints an XML representation of a TestSuite object |
| 4296 | void XmlUnitTestResultPrinter::PrintXmlTestSuite(std::ostream* stream, |
nothing calls this directly
no test coverage detected