Reputation: 943
Is there any way to print a message when using go test
regardless of success or failure without using verbose mode?
I'm generating dummy data and repeatedly running the test and would like to always tell developers the cases covered by the test.
Looking around all the questions I see about this just point to verbose mode and I don't see anything in the godoc.
Upvotes: 0
Views: 1069
Reputation: 109405
You can't in all cases.
Tests are compiled and executed by the go test
process. The stdout and stderr are captured by the parent process, and only displayed in verbose mode.
The exceptions are documented in the test code:
// stream test output (no buffering) when no package has
// been given on the command line (implicit current directory)
// or when benchmarking.
So if you are in the package directory, or running benchmarks, the stdout and stderr will be streamed through the parent process.
Upvotes: 3