Open delatrie opened 1 year ago
Wow, what an amazing and long awaiting feature here!
Hi, I have tried some workarounds to add tags or modify the description. It seems to work
In conftest.py:
import pytest
from allure_pytest_bdd.pytest_bdd_listener import PytestBDDListener
from allure_commons import plugin_manager
from allure_commons.model2 import Label
from allure_commons.types import LabelType
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
if report.when == "call":
for plugin in plugin_manager.list_name_plugin():
p = plugin[1]
if isinstance(p, PytestBDDListener):
test_result = p.lifecycle._get_item()
# add tag to allure report
for marker in item.iter_markers():
test_result.labels.append(
Label(name=LabelType.TAG, value=marker.name)
)
# add epic to allure report
test_result.labels.append(
Label(name=LabelType.EPIC, value="This is epic")
)
# modify allure report description
test_result.description = "test description"
Hello @delatrie, now is posible use the list of decorators or not? my source is: @allure.title ("Test Authentication") @allure.description("This test attempts to log into the website using a login and a password. Fails if any error happens.\n\nNote that this test does not test 2-Factor Authentication.") @allure.tag("NewUI", "Essentials", "Authentication") @allure.severity(allure.severity_level.CRITICAL) @allure.label("owner", "John Doe") @allure.link("https://dev.example.com/", name="Website") @allure.issue("AUTH-123") @allure.testcase("TMS-456") @pytest.fixture(scope='function', autouse=True) def allure_logging(request: pytest.FixtureRequest): logger = logging.getLogger(name) logger.setLevel(logging.DEBUG) stream = io.StringIO() handler = logging.StreamHandler(stream) logger.addHandler(handler)
But I can´t see in the Allure-report. Help me please.!!
Hello @delatrie Could you tell us when this feature will be implemented? It's just very strange that allure-pytest-bdd is not compatible with Allure Test Ops.
I created a pull request. https://github.com/allure-framework/allure-python/pull/818
It makes it possible to use basic allure decorators. But it only works in reporting.
@delatrie @skhomuti Could you please review it?
Currently, only allure.attach and allure.attach.file functions are supported in allure-pytest-bdd. The following functions and decorators need to be supported as well:
@allure.title
decorator@allure.description
decorator@allure.description_html
decorator@allure.label
decorator@allure.severity
decorator@allure.epic
decorator@allure.feature
decorator@allure.story
decorator@allure.suite
decorator@allure.parent_suite
decorator@allure.sub_suite
decorator@allure.tag
decorator@allure.id
decorator@allure.manual
decorator@allure.link
decorator@allure.issue
decorator@allure.testcase
decoratorallure.dynamic.title
functionallure.dynamic.description
functionallure.dynamic.description_html
functionallure.dynamic.label
functionallure.dynamic.severity
functionallure.dynamic.epic
functionallure.dynamic.feature
functionallure.dynamic.story
functionallure.dynamic.tag
functionallure.dynamic.id
functionallure.dynamic.link
functionallure.dynamic.parameter
functionallure.dynamic.issue
functionallure.dynamic.testcase
functionallure.dynamic.suite
functionallure.dynamic.parent_suite
functionallure.dynamic.sub_suite
functionallure.dynamic.manual
function