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

Command line option to disable printing World when there are failed tests or panics #192

Closed
yds12 opened this issue Dec 23, 2021 · 12 comments · Fixed by #193
Closed

Command line option to disable printing World when there are failed tests or panics #192

yds12 opened this issue Dec 23, 2021 · 12 comments · Fixed by #193
Assignees
Labels
enhancement Improvement of existing features or bugfix
Milestone

Comments

@yds12
Copy link

yds12 commented Dec 23, 2021

Hello,

First of all, thanks for the work on this awesome crate.

If I understand correctly, currently there is no way to disable printing the World in error messages. Whenever there is a failed test or panic, the whole World struct is printed. In some use cases this object can be quite large, making the errors difficult to navigate.

Would it be possible to add a command line flag that controls this behaviour?

@tyranron tyranron added this to the 0.11 milestone Dec 23, 2021
@tyranron
Copy link
Member

cc @ilslv
Let's do this as writer::Basic's CLI option and pub method before 0.11 release.

@tyranron tyranron added the enhancement Improvement of existing features or bugfix label Dec 23, 2021
@tyranron
Copy link
Member

@ilslv also, I think it's worth to bind it to the exisiting verbosity CLI option, so by default world is not printed, but with --verbose yes. What do you say?

@ilslv
Copy link
Member

ilslv commented Dec 24, 2021

@tyranron I would split them, because I think that default behaviour should be "print failed world, but not the docstring". One reason for that is I saw some of users of this crate using docstrings as some kind of spec, including graphql query there for example

@tyranron
Copy link
Member

@ilslv what about verbosity levels? -v prints world and -vv prints doc strings?

@ilslv
Copy link
Member

ilslv commented Dec 24, 2021

@tyranron good idea 👍. I don't think there will be a case when someone wants to print docstrings, but not the world.

@tyranron
Copy link
Member

@ilslv so, let's do it this way.

@theredfish
Copy link
Contributor

If there is no verbosity option passed, nothing will be printed? Or will you add a default option?

@ilslv
Copy link
Member

ilslv commented Dec 24, 2021

@tyranron

what about verbosity levels? -v prints world and -vv prints doc strings?

I believe that by default we should print World and problem this verbosity flag is that we can set -v by default, but there is no way to downgrade from here. We can make -v do nothing, -vv print World (and be default one), -vvv print both World and docstrings, but I'me sure this is idiomatic approach for verbosity flags. So I would stick with additional bool flag.

@tyranron
Copy link
Member

@ilslv why not just -v 0, -v 1, -v 2 with a -v implied -v 1 by default?

@ilslv
Copy link
Member

ilslv commented Dec 24, 2021

@yds12 @theredfish what do you think should happen by default on failed Steps: printing World or not?

@yds12
Copy link
Author

yds12 commented Dec 24, 2021

@ilslv I would say not by default.

@theredfish
Copy link
Contributor

I see printing the World as extra debug info, that I would prefer to opt-in if I need it. I think that the assertion message on failed Steps is enough as a default behavior - then if I need to debug more I can re-run failed tests with the World output.

tyranron added a commit that referenced this issue Dec 27, 2021
- make `-v` default behavior (no additional output)
- make `-vv` additionally output `World` on failed steps
- make `-vvv` additionally output docstrings (old behavior)
- add `--junit-v` CLI option for `writer::JUnit`

Co-authored-by: Kai Ren <tyranron@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing features or bugfix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants