Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
c6cb7e03
Commit
c6cb7e03
authored
Dec 13, 2018
by
Abseil Team
Committed by
jueminyang
Dec 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Googletest export
Support skipped in XML and JSON output PiperOrigin-RevId: 225386540
parent
81f00260
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
6 deletions
+34
-6
gtest.cc
googletest/src/gtest.cc
+2
-0
googletest-json-output-unittest.py
googletest/test/googletest-json-output-unittest.py
+17
-1
gtest_xml_output_unittest.py
googletest/test/gtest_xml_output_unittest.py
+8
-5
gtest_xml_output_unittest_.cc
googletest/test/gtest_xml_output_unittest_.cc
+7
-0
No files found.
googletest/src/gtest.cc
View file @
c6cb7e03
...
@@ -3761,6 +3761,7 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
...
@@ -3761,6 +3761,7 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
}
}
OutputXmlAttribute
(
stream
,
kTestcase
,
"status"
,
OutputXmlAttribute
(
stream
,
kTestcase
,
"status"
,
result
.
Skipped
()
?
"skipped"
:
test_info
.
should_run
()
?
"run"
:
"notrun"
);
test_info
.
should_run
()
?
"run"
:
"notrun"
);
OutputXmlAttribute
(
stream
,
kTestcase
,
"time"
,
OutputXmlAttribute
(
stream
,
kTestcase
,
"time"
,
FormatTimeInMillisAsSeconds
(
result
.
elapsed_time
()));
FormatTimeInMillisAsSeconds
(
result
.
elapsed_time
()));
...
@@ -4126,6 +4127,7 @@ void JsonUnitTestResultPrinter::OutputJsonTestInfo(::std::ostream* stream,
...
@@ -4126,6 +4127,7 @@ void JsonUnitTestResultPrinter::OutputJsonTestInfo(::std::ostream* stream,
}
}
OutputJsonKey
(
stream
,
kTestcase
,
"status"
,
OutputJsonKey
(
stream
,
kTestcase
,
"status"
,
result
.
Skipped
()
?
"SKIPPED"
:
test_info
.
should_run
()
?
"RUN"
:
"NOTRUN"
,
kIndent
);
test_info
.
should_run
()
?
"RUN"
:
"NOTRUN"
,
kIndent
);
OutputJsonKey
(
stream
,
kTestcase
,
"time"
,
OutputJsonKey
(
stream
,
kTestcase
,
"time"
,
FormatTimeInMillisAsDuration
(
result
.
elapsed_time
()),
kIndent
);
FormatTimeInMillisAsDuration
(
result
.
elapsed_time
()),
kIndent
);
...
...
googletest/test/googletest-json-output-unittest.py
View file @
c6cb7e03
...
@@ -57,7 +57,7 @@ else:
...
@@ -57,7 +57,7 @@ else:
STACK_TRACE_TEMPLATE
=
''
STACK_TRACE_TEMPLATE
=
''
EXPECTED_NON_EMPTY
=
{
EXPECTED_NON_EMPTY
=
{
u'tests'
:
2
3
,
u'tests'
:
2
4
,
u'failures'
:
4
,
u'failures'
:
4
,
u'disabled'
:
2
,
u'disabled'
:
2
,
u'errors'
:
0
,
u'errors'
:
0
,
...
@@ -124,6 +124,22 @@ EXPECTED_NON_EMPTY = {
...
@@ -124,6 +124,22 @@ EXPECTED_NON_EMPTY = {
]
]
},
},
{
{
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'MixedResultTest'
,
u'name'
:
u'MixedResultTest'
,
u'tests'
:
3
,
u'tests'
:
3
,
u'failures'
:
1
,
u'failures'
:
1
,
...
...
googletest/test/gtest_xml_output_unittest.py
View file @
c6cb7e03
...
@@ -65,7 +65,7 @@ else:
...
@@ -65,7 +65,7 @@ else:
sys
.
argv
.
remove
(
NO_STACKTRACE_SUPPORT_FLAG
)
sys
.
argv
.
remove
(
NO_STACKTRACE_SUPPORT_FLAG
)
EXPECTED_NON_EMPTY_XML
=
"""<?xml version="1.0" encoding="UTF-8"?>
EXPECTED_NON_EMPTY_XML
=
"""<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2
3
" failures="4" disabled="2" errors="0" time="*" timestamp="*" name="AllTests" ad_hoc_property="42">
<testsuites tests="2
4
" 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="*">
<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" time="*" classname="SuccessfulTest"/>
</testsuite>
</testsuite>
...
@@ -108,6 +108,9 @@ Invalid characters in brackets []%(stack)s]]></failure>
...
@@ -108,6 +108,9 @@ Invalid characters in brackets []%(stack)s]]></failure>
<testsuite name="DisabledTest" tests="1" failures="0" disabled="1" errors="0" time="*">
<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" time="*" classname="DisabledTest"/>
</testsuite>
</testsuite>
<testsuite name="SkippedTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="Skipped" status="skipped" time="*" classname="SkippedTest"/>
</testsuite>
<testsuite name="PropertyRecordingTest" tests="4" failures="0" disabled="0" errors="0" time="*" SetUpTestCase="yes" TearDownTestCase="aye">
<testsuite name="PropertyRecordingTest" tests="4" failures="0" disabled="0" errors="0" time="*" SetUpTestCase="yes" TearDownTestCase="aye">
<testcase name="OneProperty" status="run" time="*" classname="PropertyRecordingTest">
<testcase name="OneProperty" status="run" time="*" classname="PropertyRecordingTest">
<properties>
<properties>
...
@@ -183,15 +186,15 @@ EXPECTED_SHARDED_TEST_XML = """<?xml version="1.0" encoding="UTF-8"?>
...
@@ -183,15 +186,15 @@ EXPECTED_SHARDED_TEST_XML = """<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="SuccessfulTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<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" time="*" classname="SuccessfulTest"/>
</testsuite>
</testsuite>
<testsuite name="
NoFixtureTest" tests="1" failures="0" disabled="0" errors="0" time="*
">
<testsuite name="
PropertyRecordingTest" tests="1" failures="0" disabled="0" errors="0" time="*" SetUpTestCase="yes" TearDownTestCase="aye
">
<testcase name="RecordProperty" status="run" time="*" classname="NoFixture
Test">
<testcase name="TwoValuesForOneKeyUsesLastValue" status="run" time="*" classname="PropertyRecording
Test">
<properties>
<properties>
<property name="key" value="1
"/>
<property name="key_1" value="2
"/>
</properties>
</properties>
</testcase>
</testcase>
</testsuite>
</testsuite>
<testsuite name="Single/ValueParamTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testsuite name="Single/ValueParamTest" tests="1" failures="0" disabled="0" errors="0" time="*">
<testcase name="AnotherTestThatHasValueParamAttribute/
1" value_param="42
" status="run" time="*" classname="Single/ValueParamTest" />
<testcase name="AnotherTestThatHasValueParamAttribute/
0" value_param="33
" status="run" time="*" classname="Single/ValueParamTest" />
</testsuite>
</testsuite>
</testsuites>"""
</testsuites>"""
...
...
googletest/test/gtest_xml_output_unittest_.cc
View file @
c6cb7e03
...
@@ -67,6 +67,13 @@ TEST_F(DisabledTest, DISABLED_test_not_run) {
...
@@ -67,6 +67,13 @@ TEST_F(DisabledTest, DISABLED_test_not_run) {
FAIL
()
<<
"Unexpected failure: Disabled test should not be run"
;
FAIL
()
<<
"Unexpected failure: Disabled test should not be run"
;
}
}
class
SkippedTest
:
public
Test
{
};
TEST_F
(
SkippedTest
,
Skipped
)
{
GTEST_SKIP
();
}
TEST
(
MixedResultTest
,
Succeeds
)
{
TEST
(
MixedResultTest
,
Succeeds
)
{
EXPECT_EQ
(
1
,
1
);
EXPECT_EQ
(
1
,
1
);
ASSERT_EQ
(
1
,
1
);
ASSERT_EQ
(
1
,
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment