Allure-Markdown
Allure-Markdown 是一个 Python 项目,能将 Allure 的元数据转换为 Markdown 格式的报告。
功能特性
- 将 Allure JSON 元数据转换为 Markdown 报告
- 不需要安装 Allure 生成工具,更不需要 Java 环境
- 支持 pytest 钩子自动生成报告
- 提供命令行一键转换
- 美观易读的 Markdown 输出格式
安装
使用pip安装:
pip install allure-markdown
使用方法
1. 命令行使用
allure-markdown [OPTIONS]
参数说明:
--results-dir, -r: Allure结果目录路径(默认:allure-results)--output, -o: 输出Markdown文件路径(默认:allure_markdown_report.md)--title, -t: 报告标题(默认:Allure Markdown Report)--description, -d: 报告描述(默认:This is a markdown report generated from Allure metadata)--custom-content, -c: 标题后添加的自定义内容(默认:无)
示例:
# 使用默认配置生成报告
allure-markdown
# 指定结果目录和输出文件
allure-markdown -r allure-results -o my_report.md
# 自定义标题和描述
allure-markdown -t "My Test Report" -d "This is my custom description"
2. Pytest 钩子使用
在 pytest 命令中添加参数启用自动报告生成:
pytest --alluredir=allure-results --allure-markdown-generate
可用的 pytest 参数:
--allure-markdown-generate: 测试会话结束后从Allure结果生成Markdown报告--allure-markdown-title: 生成的Markdown报告标题--allure-markdown-description: 生成的Markdown报告描述--allure-markdown-output: 生成的Markdown报告输出路径--allure-markdown-custom-content: 标题后添加的自定义内容
示例:
# 基本使用
pytest --alluredir=allure-results --allure-markdown-generate
# 自定义报告配置
pytest --alluredir=my-results --allure-markdown-generate --allure-markdown-title="My Test Report" --allure-markdown-output="test_report.md"
Markdown 报告内容
查看报告示例:
生成的 Markdown 报告包含以下部分:
# Title
## Description
## Environment
## Summary
## Fail Details
内容说明:
- Title: 报告标题,可自定义
- Description: 报告描述,可自定义
- Environment: 环境信息,从environment.properties文件读取
- Summary: 测试汇总结果,包括通过、失败、跳过等统计
- Fail Details: 失败测试的详细信息,包括错误信息、堆栈跟踪和附件
Metadata
Release files for allure-markdown 1.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| allure_markdown-1.6.1.tar.gz | 11.7 kB | Without provenance | Details for allure_markdown-1.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| allure_markdown-1.6.1-py3-none-any.whl | Python 3 | none | any | Details for allure_markdown-1.6.1-py3-none-any.whl |
Total release size: 23.5 kB
Release files / allure_markdown-1.6.1.tar.gz
| Download URL | allure_markdown-1.6.1.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39ea1460547b91e078e51d809afd43ddbd8d1a53e6b7090436233716f014ce9d
|
|
BLAKE2b-256 checksum How to use checksums |
0e8a446db781ca511ed1114e380f98b41e59c178c3d20fb878eb8274faf8ac3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.10
|
Release files / allure_markdown-1.6.1-py3-none-any.whl
| Download URL | allure_markdown-1.6.1-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dcd8f925b41f809e472b7e214000e18f3f3888153e9fa8bb1039a031200696e2
|
|
BLAKE2b-256 checksum How to use checksums |
a4159cc43fd0c9130f2809f89e8b370a6e736e3b9d229d1abe09e2faac87e6f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.10
|
Security for allure-markdown 1.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.