Skip to main content

Enhanced Allure Attempt Summary for Playwright + Pytest

Project description

pytest-attempt-summary

Allure 报告增强版 Attempt Summary(Pytest + Playwright) Enhanced Attempt Summary for Allure Reports (Pytest + Playwright)

pytest-attempt-summary 是一个 Pytest 插件,用于收集 每个测试用例的多次执行(reruns),并在 Allure 报告中以清晰、可交互的 Attempt Summary 展示。
pytest-attempt-summary is a Pytest plugin that collects multiple test attempts (reruns) and presents them as a clear, interactive Attempt Summary in Allure Reports.

适用于使用 Pytest + Playwright + AllureUI 自动化项目
It is designed for UI automation projects using Pytest + Playwright + Allure.


功能展示 / What You Get

失败用例在 Allure 中会附带 Attempt Summary
Attempt Summary attached to failed test cases in Allure:


🔁 Attempts: 3 / 3 failed

Attempt 1 | Attempt 2 | Attempt 3 - Latest

Attempt 3 ❌ FAILED
🕑 Duration: 0.01s

▼ View Failure Details
├─ Page URL
├─ Browser Console Errors
├─ Test Failure Errors
├─ Screenshot
├─ Video (see Tear down)
└─ Trace (see Tear down)


核心特性 / Key Features

收集每个测试用例的 所有重跑尝试 / Collects all rerun attempts per test case

支持 pytest-rerunfailures / Supports pytest-rerunfailures

可交互 展开 / 收起失败详情 / Interactive expand / collapse Failure Details

高亮显示尝试之间的 错误 / 耗时差异 / Highlights error / duration differences between attempts

集成 Playwright 视频trace / Integrates with Playwright video and trace

轻量 HTML 附件(不会让 Allure 报告臃肿) / Lightweight HTML attachment (does not bloat Allure pages)


安装 / Installation

pip install pytest-attempt-summary

依赖 / Requirements:

  • pytest >= 7.0
  • allure-pytest >= 2.13

基本用法 / Basic Usage

在项目中启用 reruns(示例):/ Enable reruns in your project (example):

# pytest.ini
[pytest]
reruns = 2

运行测试并生成 Allure 报告:/ Run tests with Allure:

pytest --alluredir=allure-results
allure serve allure-results

在 Allure中打开 失败用例Attempt Summary 会显示在Test Body中。/ Open a failed test case in Allure →Attempt Summary will appear in the Test Body.


注意事项 / Important Notes

🎥 视频和 🧭 Trace 文件由 UI 项目生成可在以下位置查看。 / 🎥 Video and 🧭 Trace files are attached by your UI framework and are visible under.

Allure → Tear down → context

Attempt Summary 不直接嵌入视频或 trace,它仅指引用户到哪里查看。/ Attempt Summary does not embed videos or traces, it only guides you where to find them.

本插件 不会自动记录 attempt 需要 UI 项目自己收集每次尝试的数据(状态、错误、耗时、附件)。/ This plugin does not record attempts by itself your UI project must collect attempt data (status, error, duration, artifacts).


预期 Attempt 数据格式 / Expected Attempt Data Format

UI 自动化项目应提供类似的 attempt 数据:/ Your UI automation framework should provide attempt data like:

[
  {
    "attempt": 1,
    "status": "FAILED",
    "duration": 0.5,
    "error": "AssertionError: ...",
    "url": "https://example.com",
    "has_video": true,
    "has_trace": true
  },
  {
    "attempt": 2,
    "status": "PASSED",
    "duration": 0.3
  }
]

适用场景 / Designed For

Playwright + Pytest UI 自动化框架 / Playwright + Pytest UI automation frameworks

使用 reruns 分析不稳定用例的团队 / Teams using reruns to analyze flaky tests

关注 重试洞察 的工程师,而不仅仅是成功/失败 / Engineers who want retry insight, not just pass/fail


许可 / License

MIT License


核心一句话 / One-line Summary

Attempt Summary 帮助你理解 为什么 重试失败,而不仅仅是 失败了 / Attempt Summary helps you understand why retries fail, not just that they failed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_attempt_summary-0.1.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_attempt_summary-0.1.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file pytest_attempt_summary-0.1.0.tar.gz.

File metadata

  • Download URL: pytest_attempt_summary-0.1.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for pytest_attempt_summary-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a6ca8b726f04154299427e33f4e4bf1997fab66d588dbde16261cda400975331
MD5 26edccf17b859ee85f258d5a5046a132
BLAKE2b-256 0d430ed158e464fcc474483dee184abb0db3e0892f811cab8b0f8c47a77ba0f1

See more details on using hashes here.

File details

Details for the file pytest_attempt_summary-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_attempt_summary-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e3d8323483276aebe03f59efd36dd033277c149eebff8b6f39ec27c2c150740
MD5 5d68c38de149faf2f3d1a25f4dc7b3cf
BLAKE2b-256 bc82e21686233f305105c0854f660a2f4fc56ed550212eabd6acd879837d3326

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page