Output skipped information in the xml file.
This commit is contained in:
parent
67cc66080d
commit
59e5b401a5
@ -2270,7 +2270,8 @@ static const char* const kReservedTestSuitesAttributes[] = {
|
|||||||
// The list of reserved attributes used in the <testsuite> element of XML
|
// The list of reserved attributes used in the <testsuite> element of XML
|
||||||
// output.
|
// output.
|
||||||
static const char* const kReservedTestSuiteAttributes[] = {
|
static const char* const kReservedTestSuiteAttributes[] = {
|
||||||
"disabled", "errors", "failures", "name", "tests", "time", "timestamp"};
|
"disabled", "errors", "failures", "name",
|
||||||
|
"tests", "time", "timestamp", "skipped"};
|
||||||
|
|
||||||
// The list of reserved attributes used in the <testcase> element of XML output.
|
// The list of reserved attributes used in the <testcase> element of XML output.
|
||||||
static const char* const kReservedTestCaseAttributes[] = {
|
static const char* const kReservedTestCaseAttributes[] = {
|
||||||
@ -4080,6 +4081,7 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
|
|||||||
OutputXmlAttribute(stream, kTestsuite, "classname", test_suite_name);
|
OutputXmlAttribute(stream, kTestsuite, "classname", test_suite_name);
|
||||||
|
|
||||||
int failures = 0;
|
int failures = 0;
|
||||||
|
int skips = 0;
|
||||||
for (int i = 0; i < result.total_part_count(); ++i) {
|
for (int i = 0; i < result.total_part_count(); ++i) {
|
||||||
const TestPartResult& part = result.GetTestPartResult(i);
|
const TestPartResult& part = result.GetTestPartResult(i);
|
||||||
if (part.failed()) {
|
if (part.failed()) {
|
||||||
@ -4096,13 +4098,26 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
|
|||||||
const std::string detail = location + "\n" + part.message();
|
const std::string detail = location + "\n" + part.message();
|
||||||
OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
|
OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
|
||||||
*stream << "</failure>\n";
|
*stream << "</failure>\n";
|
||||||
|
} else if (part.skipped()) {
|
||||||
|
if (++skips == 1) {
|
||||||
|
*stream << ">\n";
|
||||||
|
}
|
||||||
|
const std::string location =
|
||||||
|
internal::FormatCompilerIndependentFileLocation(part.file_name(),
|
||||||
|
part.line_number());
|
||||||
|
const std::string summary = location + "\n" + part.summary();
|
||||||
|
*stream << " <skipped message=\""
|
||||||
|
<< EscapeXmlAttribute(summary.c_str()) << "\">";
|
||||||
|
const std::string detail = location + "\n" + part.message();
|
||||||
|
OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
|
||||||
|
*stream << "</skipped>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (failures == 0 && result.test_property_count() == 0) {
|
if (failures == 0 && skips == 0 && result.test_property_count() == 0) {
|
||||||
*stream << " />\n";
|
*stream << " />\n";
|
||||||
} else {
|
} else {
|
||||||
if (failures == 0) {
|
if (failures == 0 && skips == 0) {
|
||||||
*stream << ">\n";
|
*stream << ">\n";
|
||||||
}
|
}
|
||||||
OutputXmlTestProperties(stream, result);
|
OutputXmlTestProperties(stream, result);
|
||||||
@ -4124,7 +4139,11 @@ void XmlUnitTestResultPrinter::PrintXmlTestSuite(std::ostream* stream,
|
|||||||
OutputXmlAttribute(
|
OutputXmlAttribute(
|
||||||
stream, kTestsuite, "disabled",
|
stream, kTestsuite, "disabled",
|
||||||
StreamableToString(test_suite.reportable_disabled_test_count()));
|
StreamableToString(test_suite.reportable_disabled_test_count()));
|
||||||
|
OutputXmlAttribute(stream, kTestsuite, "skipped",
|
||||||
|
StreamableToString(test_suite.skipped_test_count()));
|
||||||
|
|
||||||
OutputXmlAttribute(stream, kTestsuite, "errors", "0");
|
OutputXmlAttribute(stream, kTestsuite, "errors", "0");
|
||||||
|
|
||||||
OutputXmlAttribute(stream, kTestsuite, "time",
|
OutputXmlAttribute(stream, kTestsuite, "time",
|
||||||
FormatTimeInMillisAsSeconds(test_suite.elapsed_time()));
|
FormatTimeInMillisAsSeconds(test_suite.elapsed_time()));
|
||||||
OutputXmlAttribute(
|
OutputXmlAttribute(
|
||||||
|
Loading…
Reference in New Issue
Block a user