There seems to be a very limited amount of people working with Allure/Python/Behave. I've been configuring my BDD (Behave) framework to run on Jenkins over the past couple of weeks and during that time i discovered Allure. It looks extremely powerful.
I'm wondering how to get screenshots attached to failed steps and have them display in the Allure report in Jenkins.
There is simple code being passed around here. I guess I'm just not sure what I'm missing or where i need to place this code.
Here's my code right now in my environment.py file for after_step
:
def after_step(context, step):
time.sleep(2)
if step.status == "failed":
allure.attach(context.browser.driver.get_screenshot_as_file
('screenshots\\{}.png'.format
(step.name)),
name="Screenshot",
attachment_type=AttachmentType.PNG)
When I open the report in Jenkins, there is no screenshot.