Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
59e5b401
"git@developer.sourcefind.cn:yangql/googletest.git" did not exist on "7d3b73c85a42811309eac26e5cbe054c40b64785"
Commit
59e5b401
authored
Mar 26, 2020
by
Mario Voorsluys
Browse files
Output skipped information in the xml file.
parent
67cc6608
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
googletest/src/gtest.cc
googletest/src/gtest.cc
+22
-3
No files found.
googletest/src/gtest.cc
View file @
59e5b401
...
@@ -2270,7 +2270,8 @@ static const char* const kReservedTestSuitesAttributes[] = {
...
@@ -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,
...
@@ -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,
...
@@ -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,
...
@@ -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
(
...
...
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