Jenkins Plugins for QA — TestNG, Allure, HTML Publisher

8 min read

A bare Jenkins installation runs shell commands and reports pass or fail. The plugin ecosystem is what turns it into a proper QA platform: interactive test reports, trend graphs across builds, coverage overlays, Slack notifications, and one-click access to screenshots from a failing test. This lesson installs and configures the plugins every QA engineer needs and wires them into a Jenkinsfile.

Installing plugins

Jenkins → Manage JenkinsPluginsAvailable plugins → search by name → Install → restart when prompted.

Some plugins need post-install configuration: Jenkins → Manage JenkinsSystem (for Slack, email) or Tools (for Allure CLI). Each plugin's documentation describes the required setup — read it before filing a bug.

JUnit Plugin (built-in)

The JUnit plugin is installed by default. It parses XML test result files in the JUnit/Surefire format and adds a test trend graph and a per-build pass/fail/skip table to every build.

post {
    always {
        junit 'target/surefire-reports/*.xml'
    }
}

This one line produces: a build-level summary (X passed, Y failed, Z skipped), a clickable list of individual failing tests, a trend graph showing pass rate across recent builds, and — critically — it marks the build UNSTABLE if any tests fail, even if the mvn test command exited 0.

The glob target/surefire-reports/*.xml covers Maven Surefire XML output. For Gradle: build/test-results/**/*.xml. For pytest: junit-results.xml (with the --junitxml flag).

TestNG Plugin

For projects using TestNG, the dedicated TestNG plugin gives better results than the JUnit plugin: it understands TestNG's group hierarchy, retry results, and listener output.

Install: search "TestNG" in Available plugins → install "TestNG Results Plugin".

post {
    always {
        step([$class: 'Publisher',
              reportFilenamePattern: '**/testng-results.xml'])
    }
}

After a build, the sidebar shows a "TestNG Results" link with a suite/test/method breakdown, failure messages, stack traces, and retry counts.

Allure Plugin

Allure is an interactive test report framework that sits on top of your test runner. Your tests write result files to target/allure-results/; the Allure Jenkins plugin reads those files and generates an HTML dashboard with timeline views, behaviour-driven breakdowns, and per-test attachments (screenshots, logs).

Install: search "Allure" in Available plugins → install "Allure Jenkins Plugin". Then install the Allure CLI: Jenkins → Manage Jenkins → Tools → Allure Commandline → Add Allure Commandline → name it allure → save.

Adding Allure to your tests (Maven + TestNG example):

<!-- pom.xml -->
<dependency>
    <groupId>io.qameta.allure</groupId>
    <artifactId>allure-testng</artifactId>
    <version>2.26.0</version>
</dependency>

Publishing in the Jenkinsfile:

post {
    always {
        allure([
            reportBuildPolicy: 'ALWAYS',
            results: [[path: 'target/allure-results']]
        ])
    }
}

After a build, the sidebar shows an "Allure Report" link. The dashboard includes: a summary donut chart, a timeline of test execution, a behaviour-driven view (when Allure annotations like @Epic, @Feature, @Story are used), and per-test attachments (screenshots, console output, API request/response bodies).

For Playwright, Allure output is configured in playwright.config.ts:

reporter: [['allure-playwright', { outputFolder: 'allure-results' }]],

The Jenkinsfile results: [[path: 'allure-results']] path changes to match.

HTML Publisher Plugin

For test reports that aren't JUnit XML or Allure — Cucumber HTML reports, ExtentReports, custom dashboards — HTML Publisher serves any HTML file as a Jenkins sidebar link.

Install: search "HTML Publisher" in Available plugins.

post {
    always {
        publishHTML([
            reportDir: 'target/cucumber-html-reports',
            reportFiles: 'overview-features.html',
            reportName: 'Cucumber Report',
            keepAll: true,
            allowMissing: false,
            alwaysLinkToLastBuild: true
        ])
    }
}

keepAll: true preserves every build's report rather than overwriting with the latest. reportName is the label that appears in the build sidebar. For Playwright's built-in HTML reporter:

publishHTML([
    reportDir: 'playwright-report',
    reportFiles: 'index.html',
    reportName: 'Playwright Report',
    keepAll: true,
    allowMissing: false
])

Note: Jenkins' Content Security Policy blocks JavaScript in published HTML by default, which breaks some interactive reports. A common workaround (set with caution on internal servers): Manage Jenkins → Script Console → System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", ""). Don't do this on public-facing Jenkins instances.

Slack Notification Plugin

Install: search "Slack Notification" → install → configure in Manage Jenkins → System → Slack (add workspace, bot token from https://api.slack.com/apps).

post {
    success {
        slackSend channel: '#qa-builds',
                  color: 'good',
                  message: "✅ *${env.JOB_NAME}* #${env.BUILD_NUMBER} passed — ${env.BUILD_URL}"
    }
    failure {
        slackSend channel: '#qa-builds',
                  color: 'danger',
                  message: "❌ *${env.JOB_NAME}* #${env.BUILD_NUMBER} failed — ${env.BUILD_URL}"
    }
    unstable {
        slackSend channel: '#qa-builds',
                  color: 'warning',
                  message: "⚠️ *${env.JOB_NAME}* #${env.BUILD_NUMBER} unstable (test failures) — ${env.BUILD_URL}"
    }
}

Send to #qa-builds for all builds, and also to #incidents or #releases for production deployments. The unstable condition is especially useful for QA — a build is UNSTABLE when tests fail but the pipeline script itself didn't error, which is exactly the state you want to alert on.

Build Timeout Plugin

A hung browser or a deadlocked test can leave a Jenkins job running for hours. The Build Timeout plugin kills it automatically.

Install: search "Build Timeout" in Available plugins.

options {
    timeout(time: 30, unit: 'MINUTES')
    buildDiscarder(logRotator(numToKeepStr: '20'))
}

Add options at the pipeline level (inside pipeline { }, before stages). buildDiscarder prevents disk exhaustion by keeping only the last 20 build records — essential on active pipelines.

⚠️ Common mistakes

  • Publishing Allure results without the CLI configured. The Allure plugin needs an Allure CLI installation to generate the report from the raw results files. If you skip the Tools configuration step, the plugin finds the results but can't render the HTML, and silently produces an empty report.
  • Forgetting allowMissing: false vs allowEmptyArchive: true. For artifact steps, allowEmptyArchive: true is correct (no files is fine on a clean run). For publishHTML, allowMissing: false is usually correct (if the report is missing, something went wrong — fail the step rather than silently skip it).
  • Sending every notification to #general. Slack notifications in #general quickly become noise that everyone ignores. Route build notifications to a dedicated #qa-builds or #ci-alerts channel so the signal stays meaningful.

🎯 Practice task

Install and configure three plugins on a Jenkins instance — 45 minutes.

  1. If you don't have a local Jenkins, run it in Docker: docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts. Complete the initial setup wizard.
  2. Install the TestNG Results Plugin and HTML Publisher Plugin from Available plugins.
  3. In a pipeline job using your Jenkinsfile from the previous lesson, add post { always { junit ... } } and post { always { publishHTML [...] } } pointing at your test output.
  4. Trigger a build. Confirm the JUnit trend graph appears and the HTML report is accessible from the build sidebar.
  5. Stretch — Allure: install the Allure Plugin. Configure the Allure CLI in Tools. Add the allure-testng dependency to your project's pom.xml. Add post { always { allure([results: [[path: 'target/allure-results']]]) } } to your Jenkinsfile. Trigger a build and open the Allure dashboard.

The next chapter leaves Jenkins behind and addresses the most impactful performance improvement in any CI pipeline: parallel execution and the strategies that make large test suites fast.

// tip to track lessons you complete and pick up where you left off across devices.