diff --git a/pkg/test/harness.go b/pkg/test/harness.go index 20d8bfe8..106c9954 100644 --- a/pkg/test/harness.go +++ b/pkg/test/harness.go @@ -612,6 +612,7 @@ func (h *Harness) Stop() { h.kind = nil } + h.DisplayFailedTest() } // wraps Test.Fatal in order to clean up harness @@ -642,6 +643,30 @@ func (h *Harness) Report() { } } +func (h *Harness) DisplayFailedTest() { + h.logTotalFailures() + h.logEachTestSuiteFailures() +} + +func (h *Harness) logTotalFailures() { + h.logger.Logf("Total test failures: %d", h.report.Failures) +} + +func (h *Harness) logEachTestSuiteFailures() { + for _, suite := range h.report.Testsuite { + h.logger.Logf("Test suite %s: %d failures", suite.Name, suite.Failures) + h.logTestCaseFailures(suite) + } +} + +func (h *Harness) logTestCaseFailures(suite *report.Testsuite) { + for _, testCase := range suite.Testcase { + if testCase.Failure != nil { + h.logger.Logf("test %s failed: %s", testCase.Name, testCase.Failure.Message) + } + } +} + // reportName returns the configured ReportName. func (h *Harness) reportName() string { if h.TestSuite.ReportName != "" {