Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
Display at end
Browse files Browse the repository at this point in the history
Signed-off-by: Shubham Gupta <[email protected]>
  • Loading branch information
shubham-cmyk committed Aug 11, 2023
1 parent 834a4da commit 1285a70
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pkg/test/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ func (h *Harness) Stop() {

h.kind = nil
}
h.DisplayFailedTest()
}

// wraps Test.Fatal in order to clean up harness
Expand Down Expand Up @@ -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 != "" {
Expand Down

0 comments on commit 1285a70

Please sign in to comment.