failures not counted correctly in some cases.
Summary output added.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user