pytest-dev / pytest-bdd

BDD library for the py.test runner
https://pytest-bdd.readthedocs.io/en/latest/
MIT License
1.29k stars 219 forks source link

Embedding made screenshot into cucumber json report #234

Open andreypetrenko82 opened 6 years ago

andreypetrenko82 commented 6 years ago

Could you implement embedding possibility of made screenshot into cucumber json report when scenario step failed?

Vic152 commented 5 years ago

+1

bubenkoff commented 5 years ago

@andreypetrenko82 this is already possible if you use pytest-splinter: https://github.com/pytest-dev/pytest-splinter/#automatic-screenshots-on-test-failure

jeduden commented 5 years ago

splinter only outputs them into a directory. in order to view the screens as part of the cucumber report they need to be embedded.

bubenkoff commented 5 years ago

did you check the mentioned jenkins plugin? https://wiki.jenkins-ci.org/display/JENKINS/JUnit+Attachments+Plugin it attaches screenshots to exact test, not just to some folder

jeduden commented 5 years ago

i am not sure why this plugin is relevant ? May be there are work arounds for some use cases where this is useful.

However, pytest bdd is missing a feature that other cucumber implementations have, embeddeding screenshots in the cucumber json:

https://relishapp.com/cucumber/cucumber/docs/formatters/json-output-formatter#embedding-screenshot

bubenkoff commented 5 years ago

@jeduden sorry I didn't know about cucumber supports screenshots then it has to be implemented as a hook.

kenhosr commented 4 years ago

hey @bubenkoff , can you please provide some more details as to how to implement it as a hook? I want to implement it but want to make sure I am on the right path.

bubenkoff commented 4 years ago

looked at https://github.com/pytest-dev/pytest-bdd/blob/master/pytest_bdd/cucumber_json.py, maybe no need in the hooks indeed, just use the screenshot paths and add to the json

kenhosr commented 4 years ago

what if we want to add some comments into the test report, in addition to screenshots?

comments

bubenkoff commented 4 years ago

those can be added to the assertion message

On Wed, Oct 9, 2019 at 5:16 PM kenhosr notifications@github.com wrote:

what if we want to add some comments into the test report, in addition to screenshots?

https://user-images.githubusercontent.com/10588269/65049617-0a8c3b80-d934-11e9-9255-e2b1049f3071.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pytest-dev/pytest-bdd/issues/234?email_source=notifications&email_token=AADIJAD5W5RW3PJCRV5HTT3QNXYVZA5CNFSM4ENUBDN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAYHY4Q#issuecomment-540048498, or mute the thread https://github.com/notifications/unsubscribe-auth/AADIJAC5YJMITSDIWHXPKQTQNXYVZANCNFSM4ENUBDNQ .

kenhosr commented 4 years ago

which hook(s) would you suggest if I do need this embedded message rather than assertion message?

iramisvalentincapco commented 4 years ago

Has there been any movement on implementation on this?

@bubenkoff You mentioned this could be implemented as a hook, how would someone go about doing that?

NickSwainston commented 2 weeks ago

I could also use this functionality. Has anyone started working on this feature?