-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated JUnit reporter #4725
Updated JUnit reporter #4725
Conversation
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only some small remarks ...
violations.map({ testCase(for: $0) }).joined(), | ||
"\n\t</testsuite>\n", | ||
"</testsuites>" | ||
].joined() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a text block instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be also possible, but I did it this way, because CheckstyleReporter
, GitHubActionsLoggingReporter
, GitLabJUnitReporter
, HTMLReporter
and XcodeReporter
also used this style.
Should I change it anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine for now. Let me refactor them in a follow-up.
</testcase> | ||
</testsuite> | ||
</testsuites> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much better! 👍
CHANGELOG.md
Outdated
@@ -73,6 +73,10 @@ | |||
[SimplyDanny](https://github.com/SimplyDanny) | |||
[#4121](https://github.com/realm/SwiftLint/issues/4121) | |||
|
|||
* Updated JUnit reporter to output error count and warning count. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to end the line with two spaces:
* Updated JUnit reporter to output error count and warning count. | |
* Updated JUnit reporter to output error count and warning count. |
|
||
return [ | ||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n", | ||
"<testsuites failures=\"\(warningCount)\" errors=\"\(errorCount)\">\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warnings are failures? Is that right?
Thank you @patricks! |
Some JUnit XML parsers require, that the warnings and errors count is set per test suite. Bitbucket Pipelines require this otherwise the errors / warnings are not recognized. I updated to code that these values are also provided. Another important value would be the total tests count (successful count + warnings count + errors count). But I couldn't figure out an easy way to get this value. I also update the format of the output.
Previous generated file output format:
New file output format: