allure-combine
Allure-combine (v1.0.11) is a Python library and console script that generates a single, self-contained HTML file from an already-generated Allure report folder. It packages all report assets (data, scripts, styles) into a `complete.html` file, allowing for easy sharing and viewing without a local web server. The latest version was released on June 29, 2023, with an infrequent release cadence.
Common errors
-
Exception: ERROR: File ./some/path/to/allure/generated/folder/index.html doesnt exists, but it should!
cause The `allure-combine` tool was pointed at the raw Allure results directory (e.g., `allure-results/`) which only contains `.json` files, instead of a *generated* Allure report directory (e.g., `allure-report/`) which contains `index.html` and other assets.fixFirst generate the Allure report from your results: `allure generate ./allure-results -o ./allure-report`. Then, use `allure-combine` on the *generated* report folder: `allure-combine ./allure-report`. -
Single HTML report created by allure-combine lacks historical data (trends, retries) from previous test runs.
cause `allure-combine` creates a self-contained HTML file from a single Allure report snapshot. It does not inherently merge or preserve historical data from previous runs that Allure Report uses for its 'Trends' and 'Retries' sections.fixTo achieve historical data, ensure your Allure test runner copies the `history` folder from previous reports into the current `allure-results` directory *before* generating the report (and subsequently combining it). However, using the native `allure generate` command with proper history management is often a more robust solution for preserving trends.
Warnings
- breaking Allure Report 3 now includes a native `--single-file` command-line argument for generating single-file HTML reports. This new functionality in Allure itself largely supersedes `allure-combine`, potentially rendering this library obsolete or less efficient. Users are encouraged to explore and use the native Allure functionality first.
- gotcha `allure-combine` requires an *already generated* Allure report folder (e.g., containing `index.html`, `data/` subfolders, etc.), not just the raw Allure results directory (e.g., `allure-results/` with `.json` files).
- gotcha The generated `complete.html` file by `allure-combine` does not fully support opening images or videos in new browser tabs, as indicated by project's 'TODO' list.
- gotcha Reports generated by `allure-combine` typically do not include historical trends or retries data. This library creates a static snapshot, and does not process the history folder in the same way native Allure Report does to show trends across multiple runs.
Install
-
pip install allure-combine
Imports
- combine_allure
from allure_combine import combine_allure
Quickstart
import os
from allure_combine import combine_allure
# Assuming an Allure report has been generated at './allure-report-generated/'
# e.g., by running `allure generate ./allure-results -o ./allure-report-generated`
report_path = './allure-report-generated'
# 1) Create complete.html in the allure-generated folder itself
# combine_allure(report_path)
# 2) Create complete.html in a specified destination folder
dest_folder = './single-html-reports'
if not os.path.exists(dest_folder):
os.makedirs(dest_folder)
combine_allure(report_path, dest_folder=dest_folder)
# You can also use the command line:
# allure-combine ./allure-report-generated --dest ./single-html-reports
print(f"Single HTML report generated from '{report_path}' to '{dest_folder}/complete.html'")