Running tests locally and viewing reports on your machine is fine for development. But the real power of Allure comes when you integrate it with CI/CD. The report gets generated automatically after every build, trends track across builds, and anyone on the team can access the report via a link. No more "can you send me the report?".
// Jenkinsfile — Complete pipeline with Allure
pipeline {
agent any
tools {
maven 'Maven-3.9'
jdk 'JDK-17'
allure 'Allure-2.25'
}
parameters {
choice(name: 'BROWSER', choices: ['chrome', 'firefox'],
description: 'Browser to run tests on')
choice(name: 'ENVIRONMENT', choices: ['qa', 'staging'],
description: 'Target environment')
string(name: 'SUITE', defaultValue: 'testng.xml',
description: 'TestNG suite file')
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Run Tests') {
steps {
sh """
mvn clean test \
-DsuiteXmlFile=${params.SUITE} \
-Dbrowser=${params.BROWSER} \
-Denv=${params.ENVIRONMENT} \
-Dheadless=true
"""
}
}
}
post {
always {
// Generate Allure report
allure([
results: [[path: 'target/allure-results']]
])
// Archive TestNG results as backup
archiveArtifacts(
artifacts: 'target/surefire-reports/**',
allowEmptyArchive: true
)
}
failure {
// Send email on test failure
emailext(
subject: "Test Failures: ${env.JOB_NAME} #${env.BUILD_NUMBER}",
body: """Tests failed in ${env.JOB_NAME}.
View Allure Report: ${env.BUILD_URL}allure/""",
recipientProviders: [developers(), requestor()]
)
}
}
}The Allure Jenkins plugin must be installed AND the Allure CLI must be configured in Global Tool Configuration. Without either one, the allure post-build step will fail silently or throw an error. Check both before your first run.
If your team uses GitHub Actions instead of Jenkins, here is how to generate Allure reports and publish them to GitHub Pages.
# .github/workflows/test-and-report.yml
name: Run Tests & Publish Allure Report
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
schedule:
- cron: '0 6 * * *' # Nightly at 6 AM UTC
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Chrome
uses: browser-actions/setup-chrome@v1
- name: Run tests
run: mvn clean test -Dheadless=true
continue-on-error: true
- name: Get Allure history
uses: actions/checkout@v4
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: Generate Allure Report
uses: simple-elf/allure-report-action@v1.9
if: always()
with:
allure_results: target/allure-results
allure_history: allure-history
keep_reports: 20
- name: Publish to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-historyAfter the first successful run, your Allure report will be available at https://yourusername.github.io/your-repo/. Trend history is preserved by keeping previous report data in the gh-pages branch. The keep_reports setting limits history to the last 20 builds.
| Jenkins + Allure | GitHub Actions + Allure |
|---|---|
| Native plugin — one-click setup | YAML config — more setup work |
| Trend history built-in automatically | Need gh-pages for history |
| Report hosted on Jenkins build page | Report hosted on GitHub Pages |
| Works behind corporate firewall | Public URL — easy to share externally |
| Best for enterprise environments | Best for open-source / startup teams |
Q: How do you integrate Allure reports with your CI/CD pipeline?
A: In our Jenkins pipeline, we use the Allure Jenkins Plugin. After the test execution stage, the post-always block calls allure([results: [[path: "target/allure-results"]]]) which generates the HTML report and hosts it as part of the build. The "Allure Report" link appears on every build page. Historical trends populate automatically across builds, showing us if the suite is getting more stable or less. For teams using GitHub Actions, I use the allure-report-action to generate the report and publish it to GitHub Pages, with history preserved across the last 20 builds.
Key Point: CI/CD integration is where Allure truly shines — automatic report generation, trend tracking across builds, and a shareable link for the whole team.