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

feat: print info statements after each test step instead of being at the end #673

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions process_testcase.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,13 @@ func (v *Venom) printTestStepResult(tc *TestCase, ts *TestStepResult, tsIn *Test
v.Println(" %s (after %d attempts)", Green(StatusPass), ts.Retries)
}
}
for _, i := range ts.ComputedInfo {
v.Println("\t %s%s %s", "\t ", Cyan("[info]"), Cyan(i))
}
for _, i := range ts.ComputedVerbose {
v.PrintlnIndentedTrace(i, "\t ")
}

}
}
}
Expand Down
1 change: 1 addition & 0 deletions process_teststep.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (v *Venom) RunTestStep(ctx context.Context, e ExecutorRunner, tc *TestCase,
if err := os.WriteFile(filename, []byte(output), 0644); err != nil {
return fmt.Errorf("Error while creating file %s: %v", filename, err)
}
tsResult.ComputedVerbose = append(tsResult.ComputedVerbose, fmt.Sprintf("writing %s", filename))
tc.computedVerbose = append(tc.computedVerbose, fmt.Sprintf("writing %s", filename))
}

Expand Down
12 changes: 2 additions & 10 deletions process_testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ func (v *Venom) runTestCases(ctx context.Context, ts *TestSuite) {
}

// Verbose mode already reported tests status, so just print them when non-verbose
indent := ""

if hasRanged || verboseReport {
indent = "\t "

// If the testcase was entirely skipped, then the verbose mode will not have any output
// Print something to inform that the testcase was indeed processed although skipped
if len(tc.TestStepResults) == 0 {
Expand All @@ -163,14 +163,6 @@ func (v *Venom) runTestCases(ctx context.Context, ts *TestSuite) {
}
}

for _, i := range tc.computedInfo {
v.Println("\t %s%s %s", indent, Cyan("[info]"), Cyan(i))
}

for _, i := range tc.computedVerbose {
v.PrintlnIndentedTrace(i, indent)
}

// Verbose mode already reported failures, so just print them when non-verbose
if !hasRanged && !verboseReport && hasFailure {
for _, testStepResult := range tc.TestStepResults {
Expand Down
1 change: 1 addition & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ type TestStepResult struct {
InputVars map[string]string `json:"inputVars" yaml:"-"`
ComputedVars H `json:"computedVars" yaml:"-"`
ComputedInfo []string `json:"computedInfos" yaml:"-"`
ComputedVerbose []string `json:"computedVerbose" yaml:"-"`
AssertionsApplied AssertionsApplied `json:"assertionsApplied" yaml:"-"`
Retries int `json:"retries" yaml:"retries"`

Expand Down