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

diag and note messages don't show up in prove output #180

Open
szabgab opened this issue Feb 10, 2021 · 6 comments
Open

diag and note messages don't show up in prove output #180

szabgab opened this issue Feb 10, 2021 · 6 comments

Comments

@szabgab
Copy link
Contributor

szabgab commented Feb 10, 2021

I called 'diag' and 'note' in the *_steps.pl file, but they are not displayed when I run prove.
Not even with 'prove -v`

I think it would be very useful to be able to see these messages, or to have some other way to add comments to the steps scripts that will show up in the output of prove

@ehuelsmann
Copy link
Collaborator

This behaviour can be explained from the fact that the test results (and note and diag output) is not used to generate output for prove to be consumed. Instead, the output is captured to determine test-success and from that, feed the formatters [one of which is a TAP formatter, which generates a new test result for each Given/When/Then line executed].

@ehuelsmann
Copy link
Collaborator

hmm. I guess one of the questions could be: what doesprove do with notes and diags inside subtests?

@ehuelsmann
Copy link
Collaborator

Ok. The behaviour that I'm seeing is to print either the diag output or the note output (but not both), even for subtests, even when prove does not run in verbose mode (although without verbose, the notes are not printed; when verbose mode chooses the note, no output appears for the non-verbose mode).

@DragosTrif
Copy link
Contributor

DragosTrif commented Aug 1, 2021

When I played around with this i noticed this behavior: When all the test pass note and diag are not printed. If the test fails both are printed.
The command i used to test this is:
carton exec -- prove -rv -m --source Feature --feature-option exetension=.feature --ext=.feature --source=Perl --ext=.t nesting
The test in step file is code run by this is:

use Test2::V0;
note('test note');
diag('test diag 1');
is( 1, 0, 'test' ) or diag('test diag 2');

Te error output prints everything

# Failed test 'Given input of Fred Bloggs'
# at nesting/features/nesting.feature line 7.
#   in step at nesting/features/nesting.feature line 7.
#     # test note
#     # test diag 1
#     not ok 2 - test
#     #   Failed test 'test'
#     #   at /home/dragos/projects/cucumber/nesting/features/step_definitions/nesting_steps.pl line 34.
#     #          got: '1'
#     #     expected: '0'
#     # test diag 2

@ehuelsmann
Copy link
Collaborator

that's correct: on error all TAP output of the step is shown. The TAP output gets captured by the Test::BDD::Cucumber harness and needs to be relayed in some form or another to prove. Currently it only does that on failure. On success, no output of the TAP is shown, because it never enters the TAP stream prove consumes: It's been eaten by the Test::BDD::Cucumber::Harness.

@ehuelsmann
Copy link
Collaborator

I'm wondering how to show the diag output even if the test did not fail.

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

3 participants