pytest-bdd icon indicating copy to clipboard operation
pytest-bdd copied to clipboard

Embedding made screenshot into cucumber json report

Open andreypetrenko82 opened this issue 6 years ago • 12 comments

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

andreypetrenko82 avatar Jan 25 '18 15:01 andreypetrenko82

+1

Vic152 avatar Nov 23 '18 16:11 Vic152

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

bubenkoff avatar Nov 23 '18 16:11 bubenkoff

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

jeduden avatar Nov 25 '18 13:11 jeduden

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

bubenkoff avatar Nov 25 '18 22:11 bubenkoff

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

jeduden avatar Nov 26 '18 04:11 jeduden

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

bubenkoff avatar Nov 26 '18 21:11 bubenkoff

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.

kenhosr avatar Oct 09 '19 14:10 kenhosr

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

bubenkoff avatar Oct 09 '19 15:10 bubenkoff

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

comments

kenhosr avatar Oct 09 '19 15:10 kenhosr

those can be added to the assertion message

On Wed, Oct 9, 2019 at 5:16 PM kenhosr [email protected] 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 .

bubenkoff avatar Oct 09 '19 15:10 bubenkoff

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

kenhosr avatar Oct 09 '19 15:10 kenhosr

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?

iramisvalentincapco avatar Apr 30 '20 20:04 iramisvalentincapco