allure-framework / allure-framework/allure-python

Allow users to actually take advantage of passed categories via message regex.

未关闭
#790 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
815
派生
260
PR 合并指标
30 天内没有已合并 PR

描述

As a user of the categories.json, I want to be able to display "Passed" categories mapped from the categories.json using the messageRegex, so that I can show different "Passed" categories by Name in the UI.

I'm submitting a ...
  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.
What is the current behavior?

In pytest_runtest_makereport, the default value of status_details is None, and when test_result.status == Status.PASSED, it's still None.

As far as I know there's no way to actually provide a message that would enable this to work in a categories.json

[
  {
    "name": "Integration Passed",
    "messageRegex": ".*IntegrationTest.*",
    "matchedStatuses": ["passed"]
  }
]
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

A simple bit of code I would expect to work

@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
    report = (yield).get_result()
    if call.when == "call" and report.passed:
        report.longrepr = "IntegrationTest Passed"
What is the expected behavior?

That I can provide a Passed Message to allure to do stuff with the categories.json

        status_details = StatusDetails(message=report.longreprtext)
Please tell us about your environment:
  • Allure version: 2.26.0
  • Test framework: pytest@7.4.2
  • Allure adaptor: allure-pytest@2.13.2
platform darwin -- Python 3.11.3, pytest-7.4.2, pluggy-1.3.0
plugins: cov-4.1.0, mock-3.11.1, anyio-3.7.1, xdist-3.3.1, check-2.2.2, allure-pytest-2.13.2
Other information

None

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 allure-pytest 适配器中的 pytest_runtest_makereport hook 开始,跟踪 report.longrepr 或 longreprtext 如何变成 status_details。为消息匹配 messageRegex 的通过报告添加覆盖测试,并验证 categories.json 可以选择命名的 Passed 类别。

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

评估

技术栈
python
领域
testing-qa
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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