allure-framework / allure-framework/allure-python
[feature] Easy way to get test_description, test_name, ecc.
- 主要语言
- Python
- 星标
- 814
- 派生
- 260
- PR 合并指标
- 30 天内没有已合并 PR
描述
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 ](https://stackoverflow.com/questions/57047461/get-dynamic-test-description-in-allure-pytest )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
贡献指南
调研方向
首先阅读 issue 中公开 Allure API 的使用方式,以及提到的 allure_pytest.listener.AllureListener 和 allure_commons._core.plugin_manager 入口点。跟踪当前如何通过 allure_logger.get_test(None) 访问测试元数据。完成的标准是:一个受支持的 getter 能够公开测试描述、名称和相关元数据,而不要求调用方传入字符串或检查私有内部实现。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- testing
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 30/100