I have some simple test file, just to test and running bazel test --test_summary=detailed --test_output=all :go_default_test yields exactly the same output as bazel test --test_summary=detailed --test_output=errors :go_default_test, whic his
INFO: Analysed target //some:go_default_test (0 packages loaded).
INFO: Found 1 test target...
FAIL: //some:go_default_test (see /home/.../go_default_test/test.log)
INFO: From Testing //some:go_default_test:
==================== Test output for //some:go_default_test:
--- FAIL: TestMeaning (0.00s)
main_test.go:8: got 1, want 42
FAIL
================================================================================
Target //some:go_default_test up-to-date:
bazel-bin/some/linux_amd64_stripped/go_default_test
INFO: Elapsed time: 2.250s, Critical Path: 0.83s
INFO: Build completed, 1 test FAILED, 6 total actions
//some:go_default_test FAILED in 0.1s
ERROR .some/linux_amd64_stripped/go_default_test
Executed 1 out of 1 test: 1 fails locally.
I would expect adding the flag --test_output=all would show me a PASS message for all the passing tests but it is not. Is there currently anyway to see some more verbose logging about passing tests?
I managed to find a workaround by specifying:
go_test(
...
args = ["-test.v"],
)
Closing old issues.
To clarify for anyone finding this later, Bazel thinks of tests as executables that just run and then exit. Tests that exit with code 0 are considered passing. --test_output=all is a Bazel flag that tells Bazel to print whatever the tests print, even when they pass. go_test doesn't know about this flag though. -test.v is the flag that Go knows about. So both flags need to be passed in (maybe the latter through --test_arg=-test.v).
Hmm, the docs on that flag are a bit more ambiguous:
Specifies desired output mode. Valid values are 'summary' to output only test status summary, 'errors' to also print test logs for failed tests, 'all' to print logs for all tests and 'streamed' to output logs for all tests in real time (this will force tests to be executed locally one at a time regardless of --test_strategy value).
Specifically the bit 'errors' to also print test logs for failed tests, 'all' to print logs for all tests that does seem to imply that passing all should yield output of all tests, so errored and non-errored ones. Why would there be two options if they do exactly the same thing?
But there is a workaround so I guess if you feel it should work the way it currently works, then fair enough.
In that help text, "tests" means test targets (which are separate binaries), not individual test cases.
--test_output=summary: Bazel runs test processes and will record whether they passed (exited with code 0) or failed (terminated some other way). Output is saved in log files in either case.--test_output=errors: Logged output from failing tests are also printed in the terminal.--test_output=all: Logged output from all tests is printed in the terminal.--test_output=streamed: Output from each test is printed as the test runs.--test_arg=-test.v: The argument -test.v is passed to the test binary. The Go testing package interprets this to mean output from all tests should be printed.Thanks for clarifying.
Most helpful comment
In that help text, "tests" means test targets (which are separate binaries), not individual test cases.
--test_output=summary: Bazel runs test processes and will record whether they passed (exited with code 0) or failed (terminated some other way). Output is saved in log files in either case.--test_output=errors: Logged output from failing tests are also printed in the terminal.--test_output=all: Logged output from all tests is printed in the terminal.--test_output=streamed: Output from each test is printed as the test runs.--test_arg=-test.v: The argument-test.vis passed to the test binary. The Gotestingpackage interprets this to mean output from all tests should be printed.