I'm setting up the reporting for automated tests with Allure & TestNG on Java. Everything works fine, just wondering if any of you tried to generate screenshots in Allure report. Where do I need to set the code responsible for this?
Asked
Active
Viewed 387 times
1 Answers
0
since there's a selenium tag on your question i assume you can use it. my solution is divided into:
taking a screen-shot using selenium. see here
add the shot as an attachment of the report. see TestNg section at allure docs
in my (python) code it looks like:
def AttachScreenshot(picName='Screenshot'):
"""
add screenshot to current step at allure
"""
Webdriver = GetDriver()
allure.attach(Webdriver.get_screenshot_as_png(), name=picName, attachment_type=AttachmentType.PNG)

itay zohar
- 177
- 10