Add test count to JUnit reporter (#6319)

This commit is contained in:
Nandhini Subramani
2025-10-25 20:27:51 +05:30
committed by GitHub
parent 4581152312
commit 4cca8280f6
3 changed files with 9 additions and 4 deletions
@@ -11,11 +11,12 @@ struct JUnitReporter: Reporter {
static func generateReport(_ violations: [StyleViolation]) -> String {
let warningCount = violations.filter({ $0.severity == .warning }).count
let errorCount = violations.filter({ $0.severity == .error }).count
let testCount = warningCount + errorCount
return """
<?xml version="1.0" encoding="utf-8"?>
<testsuites failures="\(warningCount)" errors="\(errorCount)">
\t<testsuite failures="\(warningCount)" errors="\(errorCount)">
<testsuites failures="\(warningCount)" errors="\(errorCount)" tests="\(testCount)">
\t<testsuite failures="\(warningCount)" errors="\(errorCount)" tests="\(testCount)">
\(violations.map(testCase(for:)).joined(separator: "\n"))
\t</testsuite>
</testsuites>