diff options
author | Abseil Team <absl-team@google.com> | 2019-03-22 18:36:04 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2019-03-28 21:56:02 (GMT) |
commit | 5b752b1947bbb4df571848a1afad00f9b06f30e0 (patch) | |
tree | 2ed5d3eaead4dfd832a712925d1d32d57b19517a /googletest | |
parent | 1f64659fb2ad0884d463a8797521e14dc264d54e (diff) | |
download | googletest-5b752b1947bbb4df571848a1afad00f9b06f30e0.zip googletest-5b752b1947bbb4df571848a1afad00f9b06f30e0.tar.gz googletest-5b752b1947bbb4df571848a1afad00f9b06f30e0.tar.bz2 |
Googletest export
Update XML and JSON output to be consistent with the standard.
PiperOrigin-RevId: 239833242
Diffstat (limited to 'googletest')
-rw-r--r-- | googletest/src/gtest.cc | 52 | ||||
-rw-r--r-- | googletest/test/googletest-json-outfiles-test.py | 80 | ||||
-rw-r--r-- | googletest/test/googletest-json-output-unittest.py | 658 | ||||
-rwxr-xr-x | googletest/test/gtest_xml_outfiles_test.py | 4 | ||||
-rwxr-xr-x | googletest/test/gtest_xml_output_unittest.py | 60 |
5 files changed, 518 insertions, 336 deletions
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index c6bb91d..0a04860 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -2112,8 +2112,14 @@ static const char* const kReservedTestSuiteAttributes[] = { // The list of reserved attributes used in the <testcase> element of XML output. static const char* const kReservedTestCaseAttributes[] = { - "classname", "name", "status", "time", - "type_param", "value_param", "file", "line"}; + "classname", "name", "status", "time", "type_param", + "value_param", "file", "line"}; + +// Use a slightly different set for allowed output to ensure existing tests can +// still RecordProperty("result") +static const char* const kReservedOutputTestCaseAttributes[] = { + "classname", "name", "status", "time", "type_param", + "value_param", "file", "line", "result"}; template <int kSize> std::vector<std::string> ArrayAsVector(const char* const (&array)[kSize]) { @@ -2135,6 +2141,22 @@ static std::vector<std::string> GetReservedAttributesForElement( return std::vector<std::string>(); } +// TODO(jdesprez): Merge the two getReserved attributes once skip is improved +static std::vector<std::string> GetReservedOutputAttributesForElement( + const std::string& xml_element) { + if (xml_element == "testsuites") { + return ArrayAsVector(kReservedTestSuitesAttributes); + } else if (xml_element == "testsuite") { + return ArrayAsVector(kReservedTestSuiteAttributes); + } else if (xml_element == "testcase") { + return ArrayAsVector(kReservedOutputTestCaseAttributes); + } else { + GTEST_CHECK_(false) << "Unrecognized xml_element provided: " << xml_element; + } + // This code is unreachable but some compilers may not realizes that. + return std::vector<std::string>(); +} + static std::string FormatWordList(const std::vector<std::string>& words) { Message word_list; for (size_t i = 0; i < words.size(); ++i) { @@ -3717,7 +3739,7 @@ void XmlUnitTestResultPrinter::OutputXmlAttribute( const std::string& name, const std::string& value) { const std::vector<std::string>& allowed_names = - GetReservedAttributesForElement(element_name); + GetReservedOutputAttributesForElement(element_name); GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) != allowed_names.end()) @@ -3757,9 +3779,12 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream, return; } - OutputXmlAttribute( - stream, kTestsuite, "status", - result.Skipped() ? "skipped" : test_info.should_run() ? "run" : "notrun"); + OutputXmlAttribute(stream, kTestsuite, "status", + test_info.should_run() ? "run" : "notrun"); + OutputXmlAttribute(stream, kTestsuite, "result", + test_info.should_run() + ? (result.Skipped() ? "skipped" : "completed") + : "suppressed"); OutputXmlAttribute(stream, kTestsuite, "time", FormatTimeInMillisAsSeconds(result.elapsed_time())); OutputXmlAttribute(stream, kTestsuite, "classname", test_suite_name); @@ -4065,7 +4090,7 @@ void JsonUnitTestResultPrinter::OutputJsonKey( const std::string& indent, bool comma) { const std::vector<std::string>& allowed_names = - GetReservedAttributesForElement(element_name); + GetReservedOutputAttributesForElement(element_name); GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) != allowed_names.end()) @@ -4085,7 +4110,7 @@ void JsonUnitTestResultPrinter::OutputJsonKey( const std::string& indent, bool comma) { const std::vector<std::string>& allowed_names = - GetReservedAttributesForElement(element_name); + GetReservedOutputAttributesForElement(element_name); GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) != allowed_names.end()) @@ -4123,10 +4148,13 @@ void JsonUnitTestResultPrinter::OutputJsonTestInfo(::std::ostream* stream, return; } - OutputJsonKey( - stream, kTestsuite, "status", - result.Skipped() ? "SKIPPED" : test_info.should_run() ? "RUN" : "NOTRUN", - kIndent); + OutputJsonKey(stream, kTestsuite, "status", + test_info.should_run() ? "RUN" : "NOTRUN", kIndent); + OutputJsonKey(stream, kTestsuite, "result", + test_info.should_run() + ? (result.Skipped() ? "SKIPPED" : "COMPLETED") + : "SUPPRESSED", + kIndent); OutputJsonKey(stream, kTestsuite, "time", FormatTimeInMillisAsDuration(result.elapsed_time()), kIndent); OutputJsonKey(stream, kTestsuite, "classname", test_suite_name, kIndent, diff --git a/googletest/test/googletest-json-outfiles-test.py b/googletest/test/googletest-json-outfiles-test.py index 0175e8d..b81a03d 100644 --- a/googletest/test/googletest-json-outfiles-test.py +++ b/googletest/test/googletest-json-outfiles-test.py @@ -40,23 +40,37 @@ GTEST_OUTPUT_1_TEST = 'gtest_xml_outfile1_test_' GTEST_OUTPUT_2_TEST = 'gtest_xml_outfile2_test_' EXPECTED_1 = { - u'tests': 1, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', - u'timestamp': u'*', - u'name': u'AllTests', + u'tests': + 1, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', + u'timestamp': + u'*', + u'name': + u'AllTests', u'testsuites': [{ - u'name': u'PropertyOne', - u'tests': 1, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', + u'name': + u'PropertyOne', + u'tests': + 1, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', u'testsuite': [{ u'name': u'TestSomeProperties', u'status': u'RUN', + u'result': u'COMPLETED', u'time': u'*', u'classname': u'PropertyOne', u'SetUpProp': u'1', @@ -67,23 +81,37 @@ EXPECTED_1 = { } EXPECTED_2 = { - u'tests': 1, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', - u'timestamp': u'*', - u'name': u'AllTests', + u'tests': + 1, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', + u'timestamp': + u'*', + u'name': + u'AllTests', u'testsuites': [{ - u'name': u'PropertyTwo', - u'tests': 1, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', + u'name': + u'PropertyTwo', + u'tests': + 1, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', u'testsuite': [{ u'name': u'TestSomeProperties', u'status': u'RUN', + u'result': u'COMPLETED', u'time': u'*', u'classname': u'PropertyTwo', u'SetUpProp': u'2', diff --git a/googletest/test/googletest-json-output-unittest.py b/googletest/test/googletest-json-output-unittest.py index 93028ff..64d7534 100644 --- a/googletest/test/googletest-json-output-unittest.py +++ b/googletest/test/googletest-json-output-unittest.py @@ -57,236 +57,308 @@ else: STACK_TRACE_TEMPLATE = '' EXPECTED_NON_EMPTY = { - u'tests': 24, - u'failures': 4, - u'disabled': 2, - u'errors': 0, - u'timestamp': u'*', - u'time': u'*', - u'ad_hoc_property': u'42', - u'name': u'AllTests', + u'tests': + 24, + u'failures': + 4, + u'disabled': + 2, + u'errors': + 0, + u'timestamp': + u'*', + u'time': + u'*', + u'ad_hoc_property': + u'42', + u'name': + u'AllTests', u'testsuites': [ { - u'name': u'SuccessfulTest', - u'tests': 1, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', - u'testsuite': [ - { - u'name': u'Succeeds', - u'status': u'RUN', - u'time': u'*', - u'classname': u'SuccessfulTest' - } - ] + u'name': + u'SuccessfulTest', + u'tests': + 1, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', + u'testsuite': [{ + u'name': u'Succeeds', + u'status': u'RUN', + u'result': u'COMPLETED', + u'time': u'*', + u'classname': u'SuccessfulTest' + }] }, { - u'name': u'FailedTest', - u'tests': 1, - u'failures': 1, - u'disabled': 0, - u'errors': 0, - u'time': u'*', - u'testsuite': [ - { - u'name': u'Fails', - u'status': u'RUN', - u'time': u'*', - u'classname': u'FailedTest', - u'failures': [ - { - u'failure': - u'gtest_xml_output_unittest_.cc:*\n' + u'name': + u'FailedTest', + u'tests': + 1, + u'failures': + 1, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', + u'testsuite': [{ + u'name': + u'Fails', + u'status': + u'RUN', + u'result': + u'COMPLETED', + u'time': + u'*', + u'classname': + u'FailedTest', + u'failures': [{ + u'failure': u'gtest_xml_output_unittest_.cc:*\n' u'Expected equality of these values:\n' u' 1\n 2' + STACK_TRACE_TEMPLATE, - u'type': u'' - } - ] - } - ] + u'type': u'' + }] + }] }, { - u'name': u'DisabledTest', - u'tests': 1, - u'failures': 0, - u'disabled': 1, - u'errors': 0, - u'time': u'*', - u'testsuite': [ - { - u'name': u'DISABLED_test_not_run', - u'status': u'NOTRUN', - u'time': u'*', - u'classname': u'DisabledTest' - } - ] + u'name': + u'DisabledTest', + u'tests': + 1, + u'failures': + 0, + u'disabled': + 1, + u'errors': + 0, + u'time': + u'*', + u'testsuite': [{ + u'name': u'DISABLED_test_not_run', + u'status': u'NOTRUN', + u'result': u'SUPPRESSED', + u'time': u'*', + u'classname': u'DisabledTest' + }] }, { - u'name': u'SkippedTest', - u'tests': 1, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', - u'testsuite': [ - { - u'name': u'Skipped', - u'status': u'SKIPPED', - u'time': u'*', - u'classname': u'SkippedTest' - } - ] + u'name': + u'SkippedTest', + u'tests': + 1, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', + u'testsuite': [{ + u'name': u'Skipped', + u'status': u'RUN', + u'result': u'SKIPPED', + u'time': u'*', + u'classname': u'SkippedTest' + }] }, { - u'name': u'MixedResultTest', - u'tests': 3, - u'failures': 1, - u'disabled': 1, - u'errors': 0, - u'time': u'*', + u'name': + u'MixedResultTest', + u'tests': + 3, + u'failures': + 1, + u'disabled': + 1, + u'errors': + 0, + u'time': + u'*', u'testsuite': [ { u'name': u'Succeeds', u'status': u'RUN', + u'result': u'COMPLETED', u'time': u'*', u'classname': u'MixedResultTest' }, { - u'name': u'Fails', - u'status': u'RUN', - u'time': u'*', - u'classname': u'MixedResultTest', - u'failures': [ - { - u'failure': - u'gtest_xml_output_unittest_.cc:*\n' - u'Expected equality of these values:\n' - u' 1\n 2' + STACK_TRACE_TEMPLATE, + u'name': + u'Fails', + u'status': + u'RUN', + u'result': + u'COMPLETED', + u'time': + u'*', + u'classname': + u'MixedResultTest', + u'failures': + [{ + u'failure': u'gtest_xml_output_unittest_.cc:*\n' + u'Expected equality of these values:\n' + u' 1\n 2' + STACK_TRACE_TEMPLATE, u'type': u'' }, - { - u'failure': - u'gtest_xml_output_unittest_.cc:*\n' - u'Expected equality of these values:\n' - u' 2\n 3' + STACK_TRACE_TEMPLATE, - u'type': u'' - } - ] + { + u'failure': u'gtest_xml_output_unittest_.cc:*\n' + u'Expected equality of these values:\n' + u' 2\n 3' + STACK_TRACE_TEMPLATE, + u'type': u'' + }] }, { u'name': u'DISABLED_test', u'status': u'NOTRUN', + u'result': u'SUPPRESSED', u'time': u'*', u'classname': u'MixedResultTest' } ] }, { - u'name': u'XmlQuotingTest', - u'tests': 1, - u'failures': 1, - u'disabled': 0, - u'errors': 0, - u'time': u'*', - u'testsuite': [ - { - u'name': u'OutputsCData', - u'status': u'RUN', - u'time': u'*', - u'classname': u'XmlQuotingTest', - u'failures': [ - { - u'failure': - u'gtest_xml_output_unittest_.cc:*\n' + u'name': + u'XmlQuotingTest', + u'tests': + 1, + u'failures': + 1, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', + u'testsuite': [{ + u'name': + u'OutputsCData', + u'status': + u'RUN', + u'result': + u'COMPLETED', + u'time': + u'*', + u'classname': + u'XmlQuotingTest', + u'failures': [{ + u'failure': u'gtest_xml_output_unittest_.cc:*\n' u'Failed\nXML output: <?xml encoding="utf-8">' u'<top><![CDATA[cdata text]]></top>' + STACK_TRACE_TEMPLATE, - u'type': u'' - } - ] - } - ] + u'type': u'' + }] + }] }, { - u'name': u'InvalidCharactersTest', - u'tests': 1, - u'failures': 1, - u'disabled': 0, - u'errors': 0, - u'time': u'*', - u'testsuite': [ - { - u'name': u'InvalidCharactersInMessage', - u'status': u'RUN', - u'time': u'*', - u'classname': u'InvalidCharactersTest', - u'failures': [ - { - u'failure': - u'gtest_xml_output_unittest_.cc:*\n' + u'name': + u'InvalidCharactersTest', + u'tests': + 1, + u'failures': + 1, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', + u'testsuite': [{ + u'name': + u'InvalidCharactersInMessage', + u'status': + u'RUN', + u'result': + u'COMPLETED', + u'time': + u'*', + u'classname': + u'InvalidCharactersTest', + u'failures': [{ + u'failure': u'gtest_xml_output_unittest_.cc:*\n' u'Failed\nInvalid characters in brackets' u' [\x01\x02]' + STACK_TRACE_TEMPLATE, - u'type': u'' - } - ] - } - ] + u'type': u'' + }] + }] }, { - u'name': u'PropertyRecordingTest', - u'tests': 4, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', - u'SetUpTestSuite': u'yes', - u'TearDownTestSuite': u'aye', - u'testsuite': [ - { - u'name': u'OneProperty', - u'status': u'RUN', - u'time': u'*', - u'classname': u'PropertyRecordingTest', - u'key_1': u'1' - }, - { - u'name': u'IntValuedProperty', - u'status': u'RUN', - u'time': u'*', - u'classname': u'PropertyRecordingTest', - u'key_int': u'1' - }, - { - u'name': u'ThreeProperties', - u'status': u'RUN', - u'time': u'*', - u'classname': u'PropertyRecordingTest', - u'key_1': u'1', - u'key_2': u'2', - u'key_3': u'3' - }, - { - u'name': u'TwoValuesForOneKeyUsesLastValue', - u'status': u'RUN', - u'time': u'*', - u'classname': u'PropertyRecordingTest', - u'key_1': u'2' - } - ] + u'name': + u'PropertyRecordingTest', + u'tests': + 4, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', + u'SetUpTestSuite': + u'yes', + u'TearDownTestSuite': + u'aye', + u'testsuite': [{ + u'name': u'OneProperty', + u'status': u'RUN', + u'result': u'COMPLETED', + u'time': u'*', + u'classname': u'PropertyRecordingTest', + u'key_1': u'1' + }, + { + u'name': u'IntValuedProperty', + u'status': u'RUN', + u'result': u'COMPLETED', + u'time': u'*', + u'classname': u'PropertyRecordingTest', + u'key_int': u'1' + }, + { + u'name': u'ThreeProperties', + u'status': u'RUN', + u'result': u'COMPLETED', + u'time': u'*', + u'classname': u'PropertyRecordingTest', + u'key_1': u'1', + u'key_2': u'2', + u'key_3': u'3' + }, + { + u'name': u'TwoValuesForOneKeyUsesLastValue', + u'status': u'RUN', + u'result': u'COMPLETED', + u'time': u'*', + u'classname': u'PropertyRecordingTest', + u'key_1': u'2' + }] }, { - u'name': u'NoFixtureTest', - u'tests': 3, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', + u'name': + u'NoFixtureTest', + u'tests': + 3, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', u'testsuite': [ { u'name': u'RecordProperty', u'status': u'RUN', + u'result': u'COMPLETED', u'time': u'*', u'classname': u'NoFixtureTest', u'key': u'1' @@ -294,6 +366,7 @@ EXPECTED_NON_EMPTY = { { u'name': u'ExternalUtilityThatCallsRecordIntValuedProperty', u'status': u'RUN', + u'result': u'COMPLETED', u'time': u'*', u'classname': u'NoFixtureTest', u'key_for_utility_int': u'1' @@ -301,93 +374,126 @@ EXPECTED_NON_EMPTY = { { u'name': u'ExternalUtilityThatCallsRecordStringValuedProperty', - u'status': u'RUN', - u'time': u'*', - u'classname': u'NoFixtureTest', - u'key_for_utility_string': u'1' + u'status': + u'RUN', + u'result': + u'COMPLETED', + u'time': + u'*', + u'classname': + u'NoFixtureTest', + u'key_for_utility_string': + u'1' } ] }, { - u'name': u'TypedTest/0', - u'tests': 1, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', - u'testsuite': [ - { - u'name': u'HasTypeParamAttribute', - u'type_param': u'int', - u'status': u'RUN', - u'time': u'*', - u'classname': u'TypedTest/0' - } - ] + u'name': + u'TypedTest/0', + u'tests': + 1, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', + u'testsuite': [{ + u'name': u'HasTypeParamAttribute', + u'type_param': u'int', + u'status': u'RUN', + u'result': u'COMPLETED', + u'time': u'*', + u'classname': u'TypedTest/0' + }] }, { - u'name': u'TypedTest/1', - u'tests': 1, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', - u'testsuite': [ - { - u'name': u'HasTypeParamAttribute', - u'type_param': u'long', - u'status': u'RUN', - u'time': u'*', - u'classname': u'TypedTest/1' - } - ] + u'name': + u'TypedTest/1', + u'tests': + 1, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', + u'testsuite': [{ + u'name': u'HasTypeParamAttribute', + u'type_param': u'long', + u'status': u'RUN', + u'result': u'COMPLETED', + u'time': u'*', + u'classname': u'TypedTest/1' + }] }, { - u'name': u'Single/TypeParameterizedTestSuite/0', - u'tests': 1, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', - u'testsuite': [ - { - u'name': u'HasTypeParamAttribute', - u'type_param': u'int', - u'status': u'RUN', - u'time': u'*', - u'classname': u'Single/TypeParameterizedTestSuite/0' - } - ] + u'name': + u'Single/TypeParameterizedTestSuite/0', + u'tests': + 1, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', + u'testsuite': [{ + u'name': u'HasTypeParamAttribute', + u'type_param': u'int', + u'status': u'RUN', + u'result': u'COMPLETED', + u'time': u'*', + u'classname': u'Single/TypeParameterizedTestSuite/0' + }] }, { - u'name': u'Single/TypeParameterizedTestSuite/1', - u'tests': 1, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', - u'testsuite': [ - { - u'name': u'HasTypeParamAttribute', - u'type_param': u'long', - u'status': u'RUN', - u'time': u'*', - u'classname': u'Single/TypeParameterizedTestSuite/1' - } - ] + u'name': + u'Single/TypeParameterizedTestSuite/1', + u'tests': + 1, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', + u'testsuite': [{ + u'name': u'HasTypeParamAttribute', + u'type_param': u'long', + u'status': u'RUN', + u'result': u'COMPLETED', + u'time': u'*', + u'classname': u'Single/TypeParameterizedTestSuite/1' + }] }, { - u'name': u'Single/ValueParamTest', - u'tests': 4, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', + u'name': + u'Single/ValueParamTest', + u'tests': + 4, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', u'testsuite': [ { u'name': u'HasValueParamAttribute/0', u'value_param': u'33', u'status': u'RUN', + u'result': u'COMPLETED', u'time': u'*', u'classname': u'Single/ValueParamTest' }, @@ -395,6 +501,7 @@ EXPECTED_NON_EMPTY = { u'name': u'HasValueParamAttribute/1', u'value_param': u'42', u'status': u'RUN', + u'result': u'COMPLETED', u'time': u'*', u'classname': u'Single/ValueParamTest' }, @@ -402,6 +509,7 @@ EXPECTED_NON_EMPTY = { u'name': u'AnotherTestThatHasValueParamAttribute/0', u'value_param': u'33', u'status': u'RUN', + u'result': u'COMPLETED', u'time': u'*', u'classname': u'Single/ValueParamTest' }, @@ -409,6 +517,7 @@ EXPECTED_NON_EMPTY = { u'name': u'AnotherTestThatHasValueParamAttribute/1', u'value_param': u'42', u'status': u'RUN', + u'result': u'COMPLETED', u'time': u'*', u'classname': u'Single/ValueParamTest' } @@ -418,24 +527,39 @@ EXPECTED_NON_EMPTY = { } EXPECTED_FILTERED = { - u'tests': 1, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', - u'timestamp': u'*', - u'name': u'AllTests', - u'ad_hoc_property': u'42', + u'tests': + 1, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', + u'timestamp': + u'*', + u'name': + u'AllTests', + u'ad_hoc_property': + u'42', u'testsuites': [{ - u'name': u'SuccessfulTest', - u'tests': 1, - u'failures': 0, - u'disabled': 0, - u'errors': 0, - u'time': u'*', + u'name': + u'SuccessfulTest', + u'tests': + 1, + u'failures': + 0, + u'disabled': + 0, + u'errors': + 0, + u'time': + u'*', u'testsuite': [{ u'name': u'Succeeds', u'status': u'RUN', + u'result': u'COMPLETED', u'time': u'*', u'classname': u'SuccessfulTest', }] diff --git a/googletest/test/gtest_xml_outfiles_test.py b/googletest/test/gtest_xml_outfiles_test.py index 3c715a3..eaca1a7 100755 --- a/googletest/test/gtest_xml_outfiles_test.py +++ b/googletest/test/gtest_xml_outfiles_test.py @@ -43,7 +43,7 @@ GTEST_OUTPUT_2_TEST = "gtest_xml_outfile2_test_" EXPECTED_XML_1 = """<?xml version="1.0" encoding="UTF-8"?> <testsuites tests="1" failures="0" disabled="0" errors="0" time="*" timestamp="*" name="AllTests"> <testsuite name="PropertyOne" tests="1" failures="0" disabled="0" errors="0" time="*"> - <testcase name="TestSomeProperties" status="run" time="*" classname="PropertyOne"> + <testcase name="TestSomeProperties" status="run" result="completed" time="*" classname="PropertyOne"> <properties> <property name="SetUpProp" value="1"/> <property name="TestSomeProperty" value="1"/> @@ -57,7 +57,7 @@ EXPECTED_XML_1 = """<?xml version="1.0" encoding="UTF-8"?> EXPECTED_XML_2 = """<?xml version="1.0" encoding="UTF-8"?> <testsuites tests="1" failures="0" disabled="0" errors="0" time="*" timestamp="*" name="AllTests"> <testsuite name="PropertyTwo" tests="1" failures="0" disabled="0" errors="0" time="*"> - <testcase name="TestSomeProperties" status="run" time="*" classname="PropertyTwo"> + <testcase name="TestSomeProperties" status="run" result="completed" time="*" classname="PropertyTwo"> <properties> <property name="SetUpProp" value="2"/> <property name="TestSomeProperty" value="2"/> diff --git a/googletest/test/gtest_xml_output_unittest.py b/googletest/test/gtest_xml_output_unittest.py index ce444f0..745a134 100755 --- a/googletest/test/gtest_xml_output_unittest.py +++ b/googletest/test/gtest_xml_output_unittest.py @@ -67,10 +67,10 @@ else: EXPECTED_NON_EMPTY_XML = """<?xml version="1.0" encoding="UTF-8"?> <testsuites tests="24" failures="4" disabled="2" errors="0" time="*" timestamp="*" name="AllTests" ad_hoc_property="42"> <testsuite name="SuccessfulTest" tests="1" failures="0" disabled="0" errors="0" time="*"> - <testcase name="Succeeds" status="run" time="*" classname="SuccessfulTest"/> + <testcase name="Succeeds" status="run" result="completed" time="*" classname="SuccessfulTest"/> </testsuite> <testsuite name="FailedTest" tests="1" failures="1" disabled="0" errors="0" time="*"> - <testcase name="Fails" status="run" time="*" classname="FailedTest"> + <testcase name="Fails" status="run" result="completed" time="*" classname="FailedTest"> <failure message="gtest_xml_output_unittest_.cc:*
Expected equality of these values:
 1
 2" type=""><![CDATA[gtest_xml_output_unittest_.cc:* Expected equality of these values: 1 @@ -78,8 +78,8 @@ Expected equality of these values: </testcase> </testsuite> <testsuite name="MixedResultTest" tests="3" failures="1" disabled="1" errors="0" time="*"> - <testcase name="Succeeds" status="run" time="*" classname="MixedResultTest"/> - <testcase name="Fails" status="run" time="*" classname="MixedResultTest"> + <testcase name="Succeeds" status="run" result="completed" time="*" classname="MixedResultTest"/> + <testcase name="Fails" status="run" result="completed" time="*" classname="MixedResultTest"> <failure message="gtest_xml_output_unittest_.cc:*
Expected equality of these values:
 1
 2" type=""><![CDATA[gtest_xml_output_unittest_.cc:* Expected equality of these values: 1 @@ -89,112 +89,114 @@ Expected equality of these values: 2 3%(stack)s]]></failure> </testcase> - <testcase name="DISABLED_test" status="notrun" time="*" classname="MixedResultTest"/> + <testcase name="DISABLED_test" status="notrun" result="suppressed" time="*" classname="MixedResultTest"/> </testsuite> <testsuite name="XmlQuotingTest" tests="1" failures="1" disabled="0" errors="0" time="*"> - <testcase name="OutputsCData" status="run" time="*" classname="XmlQuotingTest"> + <testcase name="OutputsCData" status="run" result="completed" time="*" classname="XmlQuotingTest"> <failure message="gtest_xml_output_unittest_.cc:*
Failed
XML output: <?xml encoding="utf-8"><top><![CDATA[cdata text]]></top>" type=""><![CDATA[gtest_xml_output_unittest_.cc:* Failed XML output: <?xml encoding="utf-8"><top><![CDATA[cdata text]]>]]><![CDATA[</top>%(stack)s]]></failure> </testcase> </testsuite> <testsuite name="InvalidCharactersTest" tests="1" failures="1" disabled="0" errors="0" time="*"> - <testcase name="InvalidCharactersInMessage" status="run" time="*" classname="InvalidCharactersTest"> + <testcase name="InvalidCharactersInMessage" status="run" result="completed" time="*" classname="InvalidCharactersTest"> <failure message="gtest_xml_output_unittest_.cc:*
Failed
Invalid characters in brackets []" type=""><![CDATA[gtest_xml_output_unittest_.cc:* Failed Invalid characters in brackets []%(stack)s]]></failure> </testcase> </testsuite> <testsuite name="DisabledTest" tests="1" failures="0" disabled="1" errors="0" time="*"> - <testcase name="DISABLED_test_not_run" status="notrun" time="*" classname="DisabledTest"/> + <testcase name="DISABLED_test_not_run" status="notrun" result="suppressed" time="*" classname="DisabledTest"/> </testsuite> <testsuite name="SkippedTest" tests="1" failures="0" disabled="0" errors="0" time="*"> - <testcase name="Skipped" status="skipped" time="*" classname="SkippedTest"/> + <testcase name="Skipped" status="run" result="skipped" time="*" classname="SkippedTest"/> </testsuite> <testsuite name="PropertyRecordingTest" tests="4" failures="0" disabled="0" errors="0" time="*" SetUpTestSuite="yes" TearDownTestSuite="aye"> - <testcase name="OneProperty" status="run" time="*" classname="PropertyRecordingTest"> + <testcase name="OneProperty" status="run" result="completed" time="*" classname="PropertyRecordingTest"> <properties> <property name="key_1" value="1"/> </properties> </testcase> - <testcase name="IntValuedProperty" status="run" time="*" classname="PropertyRecordingTest"> + <testcase name="IntValuedProperty" status="run" result="completed" time="*" classname="PropertyRecordingTest"> <properties> <property name="key_int" value="1"/> </properties> </testcase> - <testcase name="ThreeProperties" status="run" time="*" classname="PropertyRecordingTest"> + <testcase name="ThreeProperties" status="run" result="completed" time="*" classname="PropertyRecordingTest"> <properties> <property name="key_1" value="1"/> <property name="key_2" value="2"/> <property name="key_3" value="3"/> </properties> </testcase> - <testcase name="TwoValuesForOneKeyUsesLastValue" status="run" time="*" classname="PropertyRecordingTest"> + <testcase name="TwoValuesForOneKeyUsesLastValue" status="run" result="completed" time="*" classname="PropertyRecordingTest"> <properties> <property name="key_1" value="2"/> </properties> </testcase> </testsuite> <testsuite name="NoFixtureTest" tests="3" failures="0" disabled="0" errors="0" time="*"> - <testcase name="RecordProperty" status="run" time="*" classname="NoFixtureTest"> + <testcase name="RecordProperty" status="run" result="completed" time="*" classname="NoFixtureTest"> <properties> <property name="key" value="1"/> </properties> </testcase> - <testcase name="ExternalUtilityThatCallsRecordIntValuedProperty" status="run" time="*" classname="NoFixtureTest"> + <testcase name="ExternalUtilityThatCallsRecordIntValuedProperty" status="run" result="completed" time="*" classname="NoFixtureTest"> <properties> <property name="key_for_utility_int" value="1"/> </properties> </testcase> - <testcase name="ExternalUtilityThatCallsRecordStringValuedProperty" status="run" time="*" classname="NoFixtureTest"> + <testcase name="ExternalUtilityThatCallsRecordStringValuedProperty" status="run" result="completed" time="*" classname="NoFixtureTest"> <properties> <property name="key_for_utility_string" value="1"/> </properties> </testcase> </testsuite> <testsuite name="Single/ValueParamTest" tests="4" failures="0" disabled="0" errors="0" time="*"> - <testcase name="HasValueParamAttribute/0" value_param="33" status="run" time="*" classname="Single/ValueParamTest" /> - <testcase name="HasValueParamAttribute/1" value_param="42" status="run" time="*" classname="Single/ValueParamTest" /> - <testcase name="AnotherTestThatHasValueParamAttribute/0" value_param="33" status="run" time="*" classname="Single/ValueParamTest" /> - <testcase name="AnotherTestThatHasValueParamAttribute/1" value_param="42" status="run" time="*" classname="Single/ValueParamTest" /> + <testcase name="HasValueParamAttribute/0" value_param="33" status="run" result="completed" time="*" classname="Single/ValueParamTest" /> + <testcase name="HasValueParamAttribute/1" value_param="42" status="run" result="completed" time="*" classname="Single/ValueParamTest" /> + <testcase name="AnotherTestThatHasValueParamAttribute/0" value_param="33" status="run" result="completed" time="*" classname="Single/ValueParamTest" /> + <testcase name="AnotherTestThatHasValueParamAttribute/1" value_param="42" status="run" result="completed" time="*" classname="Single/ValueParamTest" /> </testsuite> <testsuite name="TypedTest/0" tests="1" failures="0" disabled="0" errors="0" time="*"> - <testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="TypedTest/0" /> + <testcase name="HasTypeParamAttribute" type_param="*" status="run" result="completed" time="*" classname="TypedTest/0" /> </testsuite> <testsuite name="TypedTest/1" tests="1" failures="0" disabled="0" errors="0" time="*"> - <testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="TypedTest/1" /> + <testcase name="HasTypeParamAttribute" type_param="*" status="run" result="completed" time="*" classname="TypedTest/1" /> </testsuite> <testsuite name="Single/TypeParameterizedTestSuite/0" tests="1" failures="0" disabled="0" errors="0" time="*"> - <testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTestSuite/0" /> + <testcase name="HasTypeParamAttribute" type_param="*" status="run" result="completed" time="*" classname="Single/TypeParameterizedTestSuite/0" /> </testsuite> <testsuite name="Single/TypeParameterizedTestSuite/1" tests="1" failures="0" disabled="0" errors="0" time="*"> - <testcase name="HasTypeParamAttribute" type_param="*" status="run" time="*" classname="Single/TypeParameterizedTestSuite/1" /> + <testcase name="HasTypeParamAttribute" type_param="*" status="run" result="completed" time="*" classname="Single/TypeParameterizedTestSuite/1" /> </testsuite> -</testsuites>""" % {'stack': STACK_TRACE_TEMPLATE} +</testsuites>""" % { + 'stack': STACK_TRACE_TEMPLATE +} EXPECTED_FILTERED_TEST_XML = """<?xml version="1.0" encoding="UTF-8"?> <testsuites tests="1" failures="0" disabled="0" errors="0" time="*" timestamp="*" name="AllTests" ad_hoc_property="42"> <testsuite name="SuccessfulTest" tests="1" failures="0" disabled="0" errors="0" time="*"> - <testcase name="Succeeds" status="run" time="*" classname="SuccessfulTest"/> + <testcase name="Succeeds" status="run" result="completed" time="*" classname="SuccessfulTest"/> </testsuite> </testsuites>""" EXPECTED_SHARDED_TEST_XML = """<?xml version="1.0" encoding="UTF-8"?> <testsuites tests="3" failures="0" disabled="0" errors="0" time="*" timestamp="*" name="AllTests" ad_hoc_property="42"> <testsuite name="SuccessfulTest" tests="1" failures="0" disabled="0" errors="0" time="*"> - <testcase name="Succeeds" status="run" time="*" classname="SuccessfulTest"/> + <testcase name="Succeeds" status="run" result="completed" time="*" classname="SuccessfulTest"/> </testsuite> <testsuite name="PropertyRecordingTest" tests="1" failures="0" disabled="0" errors="0" time="*" SetUpTestSuite="yes" TearDownTestSuite="aye"> - <testcase name="TwoValuesForOneKeyUsesLastValue" status="run" time="*" classname="PropertyRecordingTest"> + <testcase name="TwoValuesForOneKeyUsesLastValue" status="run" result="completed" time="*" classname="PropertyRecordingTest"> <properties> <property name="key_1" value="2"/> </properties> </testcase> </testsuite> <testsuite name="Single/ValueParamTest" tests="1" failures="0" disabled="0" errors="0" time="*"> - <testcase name="AnotherTestThatHasValueParamAttribute/0" value_param="33" status="run" time="*" classname="Single/ValueParamTest" /> + <testcase name="AnotherTestThatHasValueParamAttribute/0" value_param="33" status="run" result="completed" time="*" classname="Single/ValueParamTest" /> </testsuite> </testsuites>""" |