What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Jenkins can display and track automated test results when your test runner produces report files. In a Declarative Pipeline, run the tests in a stage and publish JUnit-format XML in post { always { ... } }. Jenkins collects the files; it does not run the tests for you or create reports that the test runner did not produce.
Choose a publisher that matches the report your test runner creates
Start by checking the test runner’s output format and file location. The right Jenkins publisher depends on whether you need Jenkins’ test-results interface and history, or a rendered report that your tool already generates.
As an Amazon Associate I earn from qualifying purchases.
| Runner output or goal | Jenkins approach | What to check |
|---|---|---|
| JUnit-format XML, including compatible TestNG output | Use the junit Pipeline step. |
Match testResults to the actual XML report directory, and exclude unrelated XML files. The JUnit Pipeline reference documents the step and its options. |
| A non-JUnit test-report format | Use a compatible report publisher plugin, such as the documented xunit or nunit Pipeline steps. |
Confirm that the installed plugin supports the format and syntax your runner emits. See the xUnit step reference and NUnit step reference. |
| An HTML report already generated by a test tool | Use the HTML Publisher plugin’s publishHTML step. |
Give it the report directory relative to the workspace, the report file name, and an intentional retention setting. See the HTML Publisher step reference. |
JUnit XML is the simplest documented route when the runner can produce compatible files. The Jenkins project explains that it can record and aggregate results provided the runner outputs result files; its tests and artifacts tutorial demonstrates publishing them from a Declarative Pipeline.
Publish JUnit XML from a Declarative Pipeline
Run the project’s test command in a stage, then publish the results in a pipeline-level post section. The always condition lets Jenkins attempt publication even when the test stage fails, which is useful when the runner writes reports for failed tests.
#1 Best Overall
pipeline {
agent any
stages {
stage('Test') {
steps {
sh './gradlew check'
}
}
}
post {
always {
junit 'build/reports/**/*.xml'
}
}
}
This example uses the pattern shown in Jenkins’ tutorial. Replace ./gradlew check and build/reports/**/*.xml with the command and report path for your project. The pattern is an Ant-style glob; it must match files inside the workspace. Keep it narrow enough to select test-result XML only, not every XML file in the project. The JUnit step reference specifically cautions against including non-report files.
Verify the test runner’s output first
- Run the test command locally or in the build and identify where it writes result files.
- Check whether it writes reports when tests fail. If it does not, Jenkins cannot publish results for that run merely because the step is in
post { always { ... } }. - Compare the observed directory and filenames with the
junitglob. Correct the glob rather than broadening it to unrelated XML. - Run the pipeline and open the build’s test results in Jenkins to confirm that the expected tests were found.
Jenkins’ JUnit plugin adds a results UI, failure tracking, and historical trends. Availability and exact behavior can depend on the plugin versions installed on your controller, so check the installed version’s step reference before relying on a setting.
Rank #2
Control missing reports, build status, and retained output
Publishing is also a CI policy decision: decide whether absent results are an error, how reported failures should affect status, and how much test output Jenkins should keep.
Missing or empty result files
The JUnit step’s allowEmptyResults option allows a build to continue without treating missing or empty report files as an error. Use it only when that outcome is expected. Otherwise, it can hide a broken report path or a test tool that produced no results. The default behavior and available syntax should be checked against the installed plugin version in the JUnit step reference.
Failures and build or stage status
By default, reported test failures can mark the build and pipeline stage unstable. The step documents separate controls to skip marking the build or stage unstable. Choose based on the signal your team wants: a report can remain visible even when policy treats test failures differently, but suppressing instability can make a failing test run less obvious in CI. Confirm the precise option names and behavior for the plugin version on your controller.
Standard output and memory use
The JUnit plugin documents stdioRetention modes of all, failed, and none; long output may also be truncated to conserve storage. Retaining extensive output can substantially increase Jenkins memory use. Keep full output when its debugging value warrants that cost; otherwise, retain only what your team needs to diagnose failures.
Rank #4
Publish a generated HTML report
If the test tool already creates an HTML report, install and configure the HTML Publisher plugin, then publish the report directory from the workspace. The JUnit step does not convert arbitrary HTML or another report format into JUnit results.
Recommended Free Tools
post {
always {
publishHTML(target: [
reportDir: 'build/reports/tests/test',
reportFiles: 'index.html',
reportName: 'Test Report',
keepAll: true
])
}
}
Adapt reportDir and reportFiles to the actual output from your tool. The example sets keepAll: true so the report is retained for successful builds as well; choose the retention behavior deliberately. Consult the HTML Publisher Pipeline reference for supported parameters in your installed version.
Best Value
- Used Book in Good Condition
Optional: attach a web-page screenshot as test evidence
A screenshot can document how a page looked during a test, but it is not a substitute for JUnit XML or a Jenkins test-results publisher. For reproducible evidence, first decide which URL and capture conditions your test should document, and keep the screenshot alongside the test artifacts your workflow retains.
Or skip the browser setup
For a screenshot of a URL, ScreenshotNeo provides a single GET request. It is a screenshot API, not a Jenkins test-report publisher; it does not turn test results into Jenkins trends or HTML reports. See the ScreenshotNeo API documentation for request options.
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://example.com
-o shot.webp
ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture, with each step configurable. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed; response headers indicate the page verdict and billing status. Its MCP server provides screenshot and PDF tools for AI agents, and the free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. Learn about ScreenshotNeo or sign up free for 1,000 screenshots a month with no card.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsTroubleshoot missing or misleading results
- No results appear: Check that the runner produced files in the workspace and that the
testResultsglob matches their actual path and extension. - The publisher reports no files: Verify the test stage ran, the report generation is enabled in the runner, and the path is workspace-relative. Avoid enabling
allowEmptyResultsjust to silence an unexpected missing-file condition. - Jenkins reads the wrong XML: Narrow the glob so it includes only JUnit-format result files, not unrelated XML such as configuration or other build outputs.
- Tests fail but no report is published: Confirm whether the runner writes results on failure. The
alwayspost condition makes Jenkins attempt publication; it cannot produce files the runner did not create. - Build status does not reflect test failures as expected: Review the JUnit step’s build- and stage-instability options and the installed plugin version.
- Jenkins memory use rises after enabling output retention: Reduce retained standard output from
alltofailedornoneif that still provides enough diagnostic detail. - An HTML report is absent: Confirm the HTML Publisher plugin is installed, the directory and report file exist relative to the workspace, and the paths match the tool’s output.
Optional SCM checks integration
The JUnit plugin can publish test results to supported source-control hosting checks when the required integration is installed and configured. For GitHub projects, its documentation names the GitHub Checks Plugin and GitHub App credentials as requirements. This is separate from publishing results in Jenkins; check your controller’s plugin versions and SCM configuration before enabling it. The JUnit plugin page describes the integration and its option to disable checks publishing.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




