failures not counted correctly in some cases.

Summary output added.
This commit is contained in:
2024-12-13 22:24:18 +01:00
parent 0a4ed3a95f
commit b71e4db7db
4 changed files with 56 additions and 15 deletions
+29
View File
@@ -128,4 +128,33 @@ func main() {
}
}
fmt.Printf("\n\nSUMMARY\n\n")
fmt.Printf("%-60s %-10s %-10s %-10s %-10s %-10s %-10s\n\n", "SUITE", "COUNT", "PASSED", "FAILURES", "ERRORS", "DISABLED", "SKIPPED")
for _, suite := range testsuites.Suites {
fmt.Printf("%-60s %-10d %-10d %-10d %-10d %-10d %-10d\n",
suite.Name,
suite.TestCount,
suite.TestCount-suite.Failures-suite.Errors-suite.Skipped-suite.Disabled,
suite.Failures, suite.Errors, suite.Disabled, suite.Skipped)
}
fmt.Printf("\n%-60s %-10d %-10d %-10d %-10d %-10d %-10d\n",
"TOTAL",
testsuites.Tests,
testsuites.Tests-testsuites.Failures-testsuites.Errors-testsuites.Skipped-testsuites.Disabled,
testsuites.Failures, testsuites.Errors, testsuites.Disabled, testsuites.Skipped)
if testsuites.Failures+testsuites.Errors+testsuites.Skipped+testsuites.Disabled > 0 {
fmt.Printf("\nFAILED TESTS\n\n")
printFailedTests("", "", testsuites.Suites)
}
}
func printFailedTests(indent string, parentTest string, tests []*Test) {
for _, test := range tests {
if test.Failures > 0 {
testName := strings.TrimPrefix(test.Name, parentTest+"/")
fmt.Printf("%s%s\n", indent, testName)
printFailedTests(indent+" ", test.Name, test.Tests)
}
}
}