-1

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?

Kite90
  • 9
  • 1

1 Answers1

0

since there's a selenium tag on your question i assume you can use it. my solution is divided into:

  1. taking a screen-shot using selenium. see here

  2. 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