Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass summary printing if any of the group is pass-fail #236

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions pkg/reporter/stdout_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ func PrintSingleGroupStdout(groupReport map[string][]Report) error {
totalSuccessCount += stdoutReport.Summary.Passed
totalFailureCount += stdoutReport.Summary.Failed
fmt.Println(stdoutReport.Text)
fmt.Printf("Summary: %d succeeded, %d failed\n\n", stdoutReport.Summary.Passed, stdoutReport.Summary.Failed)
if checkGroupsForPassFail(group) {
fmt.Printf("Summary: %d succeeded, %d failed\n\n", stdoutReport.Summary.Passed, stdoutReport.Summary.Failed)
}
}

fmt.Printf("Total Summary: %d succeeded, %d failed\n", totalSuccessCount, totalFailureCount)
Expand All @@ -70,7 +72,9 @@ func PrintDoubleGroupStdout(groupReport map[string]map[string][]Report) error {
totalSuccessCount += stdoutReport.Summary.Passed
totalFailureCount += stdoutReport.Summary.Failed
fmt.Println(stdoutReport.Text)
fmt.Printf(" Summary: %d succeeded, %d failed\n\n", stdoutReport.Summary.Passed, stdoutReport.Summary.Failed)
if checkGroupsForPassFail(group, group2) {
fmt.Printf(" Summary: %d succeeded, %d failed\n\n", stdoutReport.Summary.Passed, stdoutReport.Summary.Failed)
}
}
}

Expand All @@ -94,7 +98,9 @@ func PrintTripleGroupStdout(groupReport map[string]map[string]map[string][]Repor
totalSuccessCount += stdoutReport.Summary.Passed
totalFailureCount += stdoutReport.Summary.Failed
fmt.Println(stdoutReport.Text)
fmt.Printf(" Summary: %d succeeded, %d failed\n\n", stdoutReport.Summary.Passed, stdoutReport.Summary.Failed)
if checkGroupsForPassFail(groupOne, groupTwo, groupThree) {
fmt.Printf(" Summary: %d succeeded, %d failed\n\n", stdoutReport.Summary.Passed, stdoutReport.Summary.Failed)
}
}
}
}
Expand All @@ -103,6 +109,16 @@ func PrintTripleGroupStdout(groupReport map[string]map[string]map[string][]Repor
return nil
}

// Checks if any of the provided groups are "Passed" or "Failed".
func checkGroupsForPassFail(groups ...string) bool {
for _, group := range groups {
if group == "Passed" || group == "Failed" {
return false
}
}
return true
}

// Creates the standard text report
func createStdoutReport(reports []Report, indentSize int) reportStdout {
result := reportStdout{}
Expand Down
Loading