Skip to content

Commit

Permalink
Add combined output if a test fails
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBaeumer committed Oct 24, 2019
1 parent 3fa13b0 commit afb2d93
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
commander
!cmd/commander
release
dev.sh

tmp.yml
*.out
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/SimonBaeumer/commander

require (
github.com/SimonBaeumer/cmd v1.1.0
github.com/SimonBaeumer/cmd v1.2.1
github.com/antchfx/xmlquery v1.1.0
github.com/antchfx/xpath v1.1.0 // indirect
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/SimonBaeumer/cmd v1.1.0 h1:tr5dUMlly/8bLiC5B0J1AcE4ISru8POEfzAirWnUJnY=
github.com/SimonBaeumer/cmd v1.1.0/go.mod h1:4mc/LDXDWNbkeooqHP83yx3JXtInPHjJkF8zhzqqmZE=
github.com/SimonBaeumer/cmd v1.2.1 h1:NAhJp2ME68xZZJE4CVxOrNXStHdL77z1WF38OZFAQhM=
github.com/SimonBaeumer/cmd v1.2.1/go.mod h1:4mc/LDXDWNbkeooqHP83yx3JXtInPHjJkF8zhzqqmZE=
github.com/antchfx/jsonquery v1.0.0 h1:1Yhk496SrCoY6fJkFZqpXEqbwOw5sFtLns9la4NoK3I=
github.com/antchfx/jsonquery v1.0.0/go.mod h1:h7950pvPrUZzJIflNqsELgDQovTpPNa0rAHf8NwjegY=
github.com/antchfx/xmlquery v1.1.0 h1:vj0kZ1y3Q6my4AV+a9xbWrMYzubw+84zuiKgvfV8vb8=
Expand Down
1 change: 1 addition & 0 deletions pkg/output/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (w *OutputWriter) Start(results <-chan runtime.TestResult) bool {
failed++
s := w.addTries("✗ "+r.TestCase.Title, r)
w.fprintf(au.Red(s))
w.fprintf(r.TestCase.Result.Combined)
}
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type CommandResult struct {
Status ResultStatus
Stdout string
Stderr string
Combined string
ExitCode int
FailureProperties []string
Error error
Expand Down Expand Up @@ -197,6 +198,7 @@ func runTest(test TestCase) TestResult {
ExitCode: cut.ExitCode(),
Stdout: strings.TrimSpace(strings.Replace(cut.Stdout(), "\r\n", "\n", -1)),
Stderr: strings.TrimSpace(strings.Replace(cut.Stderr(), "\r\n", "\n", -1)),
Combined: strings.TrimSpace(strings.Replace(cut.Combined(), "\r\n", "\n", -1)),
}

log.Println("title: '"+test.Title+"'", " ExitCode: ", test.Result.ExitCode)
Expand Down
21 changes: 21 additions & 0 deletions vendor/github.com/SimonBaeumer/cmd/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 66 additions & 9 deletions vendor/github.com/SimonBaeumer/cmd/command.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions vendor/github.com/SimonBaeumer/cmd/multiplexed_writer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions vendor/github.com/SimonBaeumer/cmd/testing_utils.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# github.com/SimonBaeumer/cmd v1.1.0
# github.com/SimonBaeumer/cmd v1.2.1
github.com/SimonBaeumer/cmd
# github.com/antchfx/xmlquery v1.1.0
github.com/antchfx/xmlquery
Expand Down

0 comments on commit afb2d93

Please sign in to comment.