summaryrefslogtreecommitdiffstats
path: root/googletest
diff options
context:
space:
mode:
authorMario Voorsluys <mvoorsluys@lely.com>2020-03-26 12:56:05 (GMT)
committerMario Voorsluys <mvoorsluys@lely.com>2020-03-26 12:56:05 (GMT)
commit59e5b401a512a453204b9059c6a75e199a8dd8be (patch)
tree2a5b2553772ea8c8d1eb55d25d0161d3c085f9d9 /googletest
parent67cc66080d64e3fa5124fe57ed0cf15e2cecfdeb (diff)
downloadgoogletest-59e5b401a512a453204b9059c6a75e199a8dd8be.zip
googletest-59e5b401a512a453204b9059c6a75e199a8dd8be.tar.gz
googletest-59e5b401a512a453204b9059c6a75e199a8dd8be.tar.bz2
Output skipped information in the xml file.
Diffstat (limited to 'googletest')
-rw-r--r--googletest/src/gtest.cc25
1 files changed, 22 insertions, 3 deletions
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 4c8b42f..58da0f1 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -2270,7 +2270,8 @@ static const char* const kReservedTestSuitesAttributes[] = {
// The list of reserved attributes used in the <testsuite> element of XML
// output.
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.
static const char* const kReservedTestCaseAttributes[] = {
@@ -4080,6 +4081,7 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
OutputXmlAttribute(stream, kTestsuite, "classname", test_suite_name);
int failures = 0;
+ int skips = 0;
for (int i = 0; i < result.total_part_count(); ++i) {
const TestPartResult& part = result.GetTestPartResult(i);
if (part.failed()) {
@@ -4096,13 +4098,26 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
const std::string detail = location + "\n" + part.message();
OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
*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";
} else {
- if (failures == 0) {
+ if (failures == 0 && skips == 0) {
*stream << ">\n";
}
OutputXmlTestProperties(stream, result);
@@ -4124,7 +4139,11 @@ void XmlUnitTestResultPrinter::PrintXmlTestSuite(std::ostream* stream,
OutputXmlAttribute(
stream, kTestsuite, "disabled",
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, "time",
FormatTimeInMillisAsSeconds(test_suite.elapsed_time()));
OutputXmlAttribute(