Allure-RS
A comprehensive Rust library for generating Allure test reports with full feature parity to allure-js-commons.
Features
- Test metadata annotations - epic, feature, story, severity, owner, tags
- Test steps - nested step support with timing
- Attachments - text, JSON, binary files
- BDD-style steps - given, when, then, and, but
- Links - issue tracker and test management system links
- Flaky/muted test support
- Environment and categories configuration
- Async test support (tokio-first)
- Framework agnostic - works with
#[test],tokio::test,rstest
Installation
Add to your Cargo.toml:
[]
= "0.1"
Requirements
- Rust 1.75 or higher (MSRV)
- Allure CLI (for viewing reports) - Installation Guide
Quick Start
use *;
// Note: Metadata attributes must come BEFORE #[allure_test]
BDD Style
use *;
Configuration
use configure;
// Initialize before running tests
configure
.results_dir
.clean_results
.init
.unwrap;
Environment Info
use environment;
environment
.set
.set
.set_from_env
.write
.unwrap;
Supported Annotations
Important: Metadata annotations must be placed BEFORE #[allure_test] due to Rust's proc macro processing order.
| Annotation | Purpose |
|---|---|
#[allure_epic("...")] |
Top-level business capability |
#[allure_epics("...", "...")] |
Multiple epics |
#[allure_feature("...")] |
Feature under epic |
#[allure_features("...", "...")] |
Multiple features |
#[allure_story("...")] |
User story under feature |
#[allure_stories("...", "...")] |
Multiple stories |
#[allure_suite_label("...")] |
Test suite grouping |
#[allure_parent_suite("...")] |
Parent suite grouping |
#[allure_sub_suite("...")] |
Sub-suite grouping |
#[allure_severity("...")] |
Test importance (blocker/critical/normal/minor/trivial) |
#[allure_owner("...")] |
Test maintainer |
#[allure_tag("...")] |
Single tag |
#[allure_tags("...", "...")] |
Multiple tags |
#[allure_id("...")] |
Test case ID |
#[allure_title("...")] |
Custom test title |
#[allure_description("...")] |
Markdown description |
#[allure_description_html("...")] |
HTML description |
#[allure_issue("...")] |
Link to issue tracker |
#[allure_tms("...")] |
Link to test management |
#[allure_link("...")] |
Generic link |
#[allure_flaky] |
Mark test as flaky |
Viewing Reports
After running tests, generate the HTML report using the Allure CLI:
# Run tests
# Generate report
# Open report in browser
Runtime API
In addition to macros, you can use the runtime API for dynamic metadata:
use *;
Async Tests
Works with tokio::test and other async test frameworks:
use *;
async
Enable the async feature for async step support:
[]
= { = "0.1", = ["async"] }
Feature Flags
| Feature | Description |
|---|---|
async |
Enable async step support with futures crate |
tokio |
Enable tokio task-local storage for async tests |
Crate Structure
allure-rs- Main facade crate (re-exports everything)allure-core- Core types, model, and runtimeallure-macros- Procedural macros
License
MIT OR Apache-2.0