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

testname format still prints failure output with --hide-summary=output #328

Open
Tadimsky opened this issue May 4, 2023 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@Tadimsky
Copy link

Tadimsky commented May 4, 2023

I would like to use the testname format for our tests as we like being able to see each test that passed.
However, when a test fails, it prints out all of the output of that test which in our case can be many megabytes of log output.

I've tried suppressing this with --hide-summary=output but it looks like it's not from the summary and is rather part of the testname output.

I'm running these tests in GitLab CI and so whenever there is a test failure GitLab is unable to capture all of the output and so we can't see what actually happened. I'm sending the standard-verbose output to a file so I can look there to see exactly what happened.

Is there some config that I'm missing that will let me do this? Or is this something that testname does not support?

@dnephin dnephin added the enhancement New feature or request label May 4, 2023
@dnephin
Copy link
Member

dnephin commented May 4, 2023

That you for raising this issue! Currently it's not possible to hide the test failure output with testname.

In #326 we talked about adding a --format-with-fails flag. This flag would be a way to include the test failure output, but I think we could use --format-with-fails=false to hide the output from testname.

I'm sending the standard-verbose output to a file so I can look there to see exactly what happened.

As a workaround until we add the new flag, another way to accomplish this is to use --jsonfile=<filename>. That should let you use the testname format, while still getting the full output in a file. You can turn the jsonfile into the standard-verbose format using:

gotestsum --raw-command -f standard-verbose -- cat jsonfile.log 

You could do that before saving the artifact if you want to save the human readable output instead of the jsonfile.

@Tadimsky
Copy link
Author

Tadimsky commented May 4, 2023

Ok, great! Yeah #326 seems like that would be perfect for us!

Yeah this is kinda what I'm doing right now:

go run gotest.tools/gotestsum --format testname --no-color=false --junitfile unit-tests.xml --jsonfile tests.json -- -vet=off -v -tags=test_unit ./... | grep -v EMPTY
go run gotest.tools/gotestsum --format standard-verbose --raw-command -- cat tests.json > test_unit.log

It's been working great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants