1

I have tried this code : https://github.com/SharifKhan515/Orange_Hr_Automation and everything work well, include with the report. but I need more information how using gherkin style in the report and I change the allure allure-pytest to be allure-pytest-bdd but i found issue.

and the error like this : enter image description here

all package enter image description here

  1. is there any special technique to run generate report pytest-bdd Or it's a bug?

I need report like behave pytest enter image description here but the reality like this enter image description here and result.json like this

{"name": "Login with credential [Admin-admin123]", "status": "failed", "statusDetails": {"message": "Failed: Fixture \"do_login\" called directly. Fixtures are not meant to be called directly,\nbut are created automatically when test functions request them as parameters.\nSee https://docs.pytest.org/en/stable/explanation/fixtures.html for more information about fixtures, and\nhttps://docs.pytest.org/en/stable/deprecations.html#calling-fixtures-directly about how to update your code.", "trace": "Fixture \"do_login\" called directly. Fixtures are not meant to be called directly,\nbut are created automatically when test functions request them as parameters.\nSee https://docs.pytest.org/en/stable/explanation/fixtures.html for more information about fixtures, and\nhttps://docs.pytest.org/en/stable/deprecations.html#calling-fixtures-directly about how to update your code."}, "steps": [{"name": "Given I am at login page of OrangeHrm", "status": "passed", "start": 1664612950522, "stop": 1664612972689}, {"name": "When I enter \"Admin\" in user field \"admin123\" in password field and click login", "status": "skipped", "start": 1664612972785, "stop": 1664612974841}], "attachments": [{"name": "<function_navigate_to_login_page_at_0x0000024B20BED700>_2022-10-01_15:29.png", "source": "2d33fcfa-6958-42a5-bcc6-8616d4dd61b2-attachment.png", "type": "image/png"}], "parameters": [{"name": "_pytest_bdd_example", "value": {"username": "Admin", "password": "admin123"}}], "start": 1664612950522, "stop": 1664612972785, "uuid": "ab384528-4856-15ff-96bb-749a11537401", "historyId": "ab384528485615ff96bb749a11537401", "fullName": "features\\login.feature:Login with credential", "labels": [{"name": "host", "value": "Aljazari"}, {"name": "thread", "value": "21844-MainThread"}, {"name": "framework", "value": "pytest-bdd"}, {"name": "language", "value": "cpython3"}, {"name": "feature", "value": "Login feature"}]}
Dzone
  • 11
  • 2

2 Answers2

0

This issue occurs when you have all of your features with Scenario Outlines(Using Example Table) instead of Scenarios. There is no actual fix available, but the workaround is to add a code snippet in your conftest.py. Details and Code snippet can be viewed here. https://github.com/allure-framework/allure-python/issues/636

Y5288
  • 163
  • 1
  • 14
  • already add the code, but still same cannot generate allure report pytest bdd – Dzone Oct 12 '22 at 23:53
  • can you try with scenario only, instead of scenario outline in your feature files. The code suggested, did work for me. – Y5288 Oct 14 '22 at 17:04
0

Pytest-bdd wraps Scenario Outline parameters in _pytest_bdd_example starting with the version 5. And allure-pytest-bdd doesn't serialize parameter values properly leading to report generation error if a parameter value has a complex type (like in this case - a dictionary).

The bug with Scenario Outline parameters was recently fixed. The fix is not released yet but will be released soon.