allure-framework / allure-framework/allure-python

Resolving 'fullName' Field Issue in Allure-Pytest: A Local Solution and Call for Official Adjustment

未关闭
#751 0 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
814
派生
260
PR 合并指标
30 天内没有已合并 PR

描述

Hello, currently I am using Allure TestOps to manage my automated tests, and after much searching, I finally found a small issue that was not noticeable before in allure-pytest. The problem is that when I run tests with examples using (@pytest.mark.parametrize) with more than one test, at the end of the execution, the result.json file is filled with the "fullName" field containing only the test name without the examples appended. In other words, when I add the execution results to TestOps, it considers it as a single test instead of the multiple tests I have in the parametrize. Here's an example below:

![image](https://github.com/allure-framework/allure-python/assets/58951154/10e65dca-6f50-48ef-8b2c-51aaf4d2ded6)

After cloning the allure-python repository, I was able to identify that in the utils.py file of allure-pytest, on line 122, the method "allure_full_name" is located. What I did to test it locally was to modify the line that previously read:

test = item.originalname if isinstance(item, pytest.Function) else item.name.split("[")[0]

to:
test = item.name

After reinstalling the library locally, the issue was resolved as evidenced below:

![image](https://github.com/allure-framework/allure-python/assets/58951154/c271343c-eb72-4753-8d0f-0b50ae68b917)

I didn't encounter any functionality issues with allure-pytest after making this local modification. Can you make this adjustment officially in the library?

贡献指南

打开贡献指南

调研方向

从 allure-pytest/utils.py 中第 122 行附近的 allure_full_name 方法开始,使用包含多个示例的 pytest.mark.parametrize 测试复现该问题。检查生成的 result.json,并确认每个参数化结果都有不同的 fullName,以便 TestOps 分别识别这些测试。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
testing
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。