What Is Allure?
Allure is an open-source test reporting framework that transforms raw test results into rich, interactive HTML reports. While most test frameworks produce basic pass/fail summaries, Allure creates detailed reports with test steps, screenshots, network logs, execution timelines, historical trends, and categorized failures.
Allure integrates with nearly every major test framework: JUnit, TestNG, Pytest, Jest, Mocha, Playwright, Cypress, and more. It works as a two-step process: first, your tests generate Allure result files during execution; second, the Allure CLI generates an HTML report from those files.
Why Use Allure?
Standard test reports answer one question: how many tests passed? Allure answers many more:
- What exactly did each test do? Step-by-step execution with screenshots at each step
- Why did it fail? Categorized failures with stack traces, screenshots, and attached evidence
- Is this a new failure or a known issue? Historical trends and flaky test detection
- Which features are affected? Tests organized by feature, story, and severity
- How long did each test take? Execution timelines and duration graphs
Setting Up Allure
Installation
# Install Allure CLI
# macOS
brew install allure
# Linux
sudo apt-add-repository ppa:qameta/allure
sudo apt-get update
sudo apt-get install allure
# npm (cross-platform)
npm install -g allure-commandline
Java (JUnit 5 + Maven)
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit5</artifactId>
<version>2.25.0</version>
<scope>test</scope>
</dependency>
Python (Pytest)
pip install allure-pytest
pytest --alluredir=allure-results
JavaScript (Playwright)
npm install allure-playwright
# In playwright.config.ts:
# reporter: [['allure-playwright']]
Allure Annotations
Steps
@Test
@Description("Verify user can log in with valid credentials")
@Severity(SeverityLevel.CRITICAL)
@Feature("Authentication")
@Story("Login")
public void testSuccessfulLogin() {
openLoginPage();
enterCredentials("admin@example.com", "password123");
clickLoginButton();
verifyDashboardDisplayed();
}
@Step("Open the login page")
public void openLoginPage() {
driver.get(baseUrl + "/login");
}
@Step("Enter credentials: {email}")
public void enterCredentials(String email, String password) {
driver.findElement(By.id("email")).sendKeys(email);
driver.findElement(By.id("password")).sendKeys(password);
}
@Step("Click the login button")
public void clickLoginButton() {
driver.findElement(By.id("submit")).click();
}
@Step("Verify dashboard is displayed")
public void verifyDashboardDisplayed() {
WebElement welcome = driver.findElement(By.className("welcome"));
Allure.step("Check welcome text", () -> {
assertEquals("Welcome, Admin", welcome.getText());
});
}
Attachments
@Attachment(value = "Screenshot", type = "image/png")
public byte[] takeScreenshot() {
return ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
}
@Attachment(value = "API Response", type = "application/json")
public String attachResponse(String responseBody) {
return responseBody;
}
// Attach on failure
@AfterEach
public void captureFailure(TestInfo testInfo) {
if (testInfo.getTestMethod().isPresent()) {
takeScreenshot();
}
}
Severity and Labels
@Severity(SeverityLevel.BLOCKER) // Blocker, Critical, Normal, Minor, Trivial
@Feature("Shopping Cart")
@Story("Add to Cart")
@Epic("E-Commerce")
@Owner("qa-team")
@Link(name = "JIRA-1234", url = "https://jira.example.com/JIRA-1234")
@Issue("BUG-567")
@TmsLink("TC-890")
Generating Reports
# Generate and open report
allure serve allure-results
# Generate report to a directory
allure generate allure-results -o allure-report --clean
# Open generated report
allure open allure-report
Report Sections
Overview Dashboard
The main dashboard shows:
- Pass/Fail/Broken/Skipped counts and percentages
- Severity breakdown across all tests
- Feature coverage — which features have passing tests
- Duration trend — how test execution time changes over runs
- Categories — grouped failure reasons
Suites and Behaviors Views
- Suites: Tests organized by test class and package (technical view)
- Behaviors: Tests organized by Epic > Feature > Story (business view)
The Behaviors view is especially valuable for stakeholders who want to understand test coverage in business terms rather than technical test class names.
Timeline View
Shows when each test started and finished, visualizing parallel execution and identifying long-running tests that bottleneck the suite.
Categories Configuration
// categories.json — placed in allure-results/
[
{
"name": "Product Defects",
"matchedStatuses": ["failed"],
"messageRegex": ".*AssertionError.*"
},
{
"name": "Test Infrastructure Issues",
"matchedStatuses": ["broken"],
"messageRegex": ".*TimeoutException.*|.*ConnectionRefused.*"
},
{
"name": "Known Issues",
"matchedStatuses": ["failed"],
"messageRegex": ".*KNOWN-BUG-\\d+.*"
}
]
Allure in CI/CD
GitHub Actions
- name: Run tests
run: mvn test
continue-on-error: true
- name: Generate Allure Report
uses: simple-elf/allure-report-action@master
with:
allure_results: target/allure-results
- name: Deploy Report to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: allure-report
Historical Trends
To enable trend graphs across CI runs, preserve the allure-report/history directory from the previous run and copy it into allure-results/history before generating the new report.
Python Example (Pytest)
import allure
@allure.feature("Authentication")
@allure.story("Login")
@allure.severity(allure.severity_level.CRITICAL)
def test_successful_login(page):
with allure.step("Open login page"):
page.goto("/login")
with allure.step("Enter credentials"):
page.fill("#email", "admin@example.com")
page.fill("#password", "password123")
with allure.step("Submit form"):
page.click("#submit")
with allure.step("Verify dashboard"):
assert page.text_content(".welcome") == "Welcome, Admin"
allure.attach(
page.screenshot(),
name="Dashboard Screenshot",
attachment_type=allure.attachment_type.PNG
)
Exercises
Exercise 1: Allure Setup
- Add Allure dependencies to an existing test project (Java, Python, or JavaScript)
- Annotate 5 existing tests with @Step, @Feature, @Story, and @Severity
- Generate an Allure report and explore each section
- Add screenshot attachment on test failure
Exercise 2: Categories and History
- Create a categories.json file that classifies failures into product defects, test defects, and known issues
- Run tests twice and configure history to see trend graphs
- Identify the longest-running test from the Timeline view
- Create a summary of findings as if reporting to a QA Lead
Exercise 3: CI/CD Integration
- Add Allure report generation to a CI pipeline (GitHub Actions or Jenkins)
- Configure historical trend tracking across builds
- Set up report publishing so team members can access reports via a URL
- Add automatic screenshot and API response attachments to all failing tests