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.1.tar.gz (16.2 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.1-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest_attempt_summary-0.1.1.tar.gz
  • Upload date:
  • Size: 16.2 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.1.tar.gz
Algorithm Hash digest
SHA256 bdfac8a65b1e0d0288e0a484fd23cb4df4af6e92eabd682d387219deadd4db38
MD5 832c1d8f3f6f8f44a454d24205deb4c1
BLAKE2b-256 cc30801886a5eedecbec8911be443db1aa9bdce98bab703a443c26bdc2a0a584

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytest_attempt_summary-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 21484484f2fbf5dd5d7985ffe445db8c482ac7ac664ee0f8aebc6a6053deec7d
MD5 b2885015e37ca60e85f86eb556d49640
BLAKE2b-256 ba225dc6152476602f8859deb36fe77c7ad5909949a5da2e40b382baf4d56554

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