allure-python icon indicating copy to clipboard operation
allure-python copied to clipboard

[feature] Easy way to get test_description, test_name, ecc.

Open ric79 opened this issue 6 years ago • 0 comments

Hello, this is a feature request. I need to get easily the test description, name, ecc inside a private function. I do not want to pass them as strings. I know that it is quite easy to set them

allure.dynamic.description("""blah blah""")

I asked on Stackoverflow how to get them and here there is the code:

import allure
from allure_commons._core import plugin_manager
from allure_pytest.listener import AllureListener

@allure.title("MYTITLE")
def test_A1(request):
    allure.dynamic.description("""MYDESC""")
    myfunct()


def myfunct():
    plugin = next(p for p in plugin_manager.get_plugins() if isinstance(p, AllureListener))
    testdescription = plugin.allure_logger.get_test(None).description
    ...

I would like to know whether in future versions it could be possibile to add a "getter" method. Thanks, Riccardo

ric79 avatar Jul 18 '19 07:07 ric79