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

Support multiple formatter outputs to different locations #518

Closed
jasondborneman opened this issue Jan 5, 2023 · 2 comments
Closed

Support multiple formatter outputs to different locations #518

jasondborneman opened this issue Jan 5, 2023 · 2 comments

Comments

@jasondborneman
Copy link

🤔 What's the problem you're trying to solve?

Currently (AFAIK) you can only define a single --godog.format output for your tests. Ideally you could define multiple outputs, one for stdout to the command line and any number of other outputs to files.

This would be useful so that, for example, you run tests as part of CI/CD and can see --godog.format=pretty on the command line output, but send --godog.format=junit:file.xml to the file and BOTH would work.

✨ What's your proposed solution?

Support multiple format options. Maybe something like this on the command line:

$ go test --godog.format=pretty:stdout --godog.format=junit:file.xml

This would send pretty format to stdout but send the junit report to a file.

⛏ Have you considered any alternatives or workarounds?

I tried gotestsum as a solution, but its junit reports seem... iffy. They show 0 tests and a failure just shows all output in the testcase block. The junit reports that come with godog natively are MUCH better and would like to use those instead.

📚 Any additional context?

Feel free to contact me in the comments here to clarify anything that is needed. This would be a huge level up for what we're trying to do! Maybe there's already a way to do this and I just missed it since I'm new to godog. Thanks!

@vearutop
Copy link
Member

vearutop commented Jan 5, 2023

It is not properly documented, but this is already possible with comma-separated values.

Please try:

$ go test --godog.format=pretty:stdout,junit:file.xml

@jasondborneman
Copy link
Author

You rock, @vearutop! Although it looks like it actually needs to be:

$ go test --godog.format=pretty,junit:file.xml

No :stdout, but other than that it works a charm. I should have tried that!

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

No branches or pull requests

2 participants