Jenkins : JUnit Plugin

Allows JUnit-format test results to be published.

Plugin Information

View JUnit on the plugin site for more information.

Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:

The JUnit plugin provides a publisher that consumes XML test reports generated during the builds and provides some graphical visualization of the historical test results (see JUnit graph for a sample) as well as a web UI for viewing test reports, tracking failures, and so on. Jenkins understands the JUnit test report XML format (which is also used by TestNG). When this option is configured, Jenkins can provide useful information about test results, such as trends.

This functionality was part of the Jenkins Core until it was split out to this plugin in version in 1.577.


The JUnit publisher is configured at the job level by adding a Publish JUnit test result report post build action. The configuration parameters include:

  • Test report XMLs: Specify the path to JUnit XML files in the Ant glob syntax, such as **/build/test-reports/*.xml. Be sure not to include any non-report files into this pattern. You can specify multiple patterns of files separated by commas. The base directory of the fileset is the workspace root.
  • Retain long standard output/error: If checked, any standard output or error from a test suite will be retained in the test results after the build completes. (This refers only to additional messages printed to console, not to a failure stack trace). Such output is always kept if the test failed, but by default lengthy output from passing tests is truncated to save space. Check this option if you need to see every log message from even passing tests, but beware that Jenkins's memory consumption can substantially increase as a result, even if you never look at the test results!
  • Health report amplification factor: The amplification factor to apply to test failures when computing the test result contribution to the build health score. The default factor is 1.0. A factor of 0.0 will disable the test result contribution to build health score, and, as an example, a factor of 0.5 means that 10% of tests failing will score 95% health. The factor is persisted with the build results, so changes will only be reflected in new builds.
  • Allow empty results: If checked, the default behavior of failing a build on missing test result files or empty test results is changed to not affect the status of the build. Please note that this setting make it harder to spot misconfigured jobs or build failures where the test tool does not exit with an error code when not producing test report files.


Version 1.28 (May 14 2019)

This plugin now requires Jenkins 2.138.4 or newer.

  • JENKINS-31660 - Do not load attempt to load test history for skipped tests. This fixes some cases where a StackOverflowError  was being thrown.
  • JENKINS-39203 - Use a new API provided by Pipeline API Plugin version 2.34 to identify the junit  step as the source of an unstable build when tests fail.
    • Note: In order for stage-related results to be visualized differently in Blue Ocean, you must update Pipeline: Graph Analysis Plugin to version 1.10 or newer.

Version 1.27 (Feb 8 2019)

  • JENKINS-42438 - Correctly report test duration for classes.
  • PR 114 - If a skipped test does not have an explicit message, compute one using the available information in the XML document.

Version 1.26.1 (Sep 25 2018)

  • Fix an error causing NullPointerException to be thrown in version 1.26 of this plugin.

Version 1.26 (Sep 25 2018)

Version 1.25 (Sep 12 2018)

Version 1.24 (Feb 5 2018)

Version 1.23 (Nov 27 2017)

  • JENKINS-48178 - Set run result in junit step rather than getContext().setResult(...)
  • JENKINS-48196 - Remove redundant parallel branch names from CaseResult display name when appropriate.

Version 1.22.2 (Nov 15 2017)

  • JENKINS-48020 - Get rid of warnings spam in logs and add stage info to failed tests list.

Version 1.22.1 (Nov 14 2017)

  • Fixing junit step on masters without pipeline-stage-step installed.

Version 1.22 (Nov 14 2017)

  • JENKINS-37598 - Fix aggregation issues for multiple files containing cases for the same suite
  • JENKINS-27395 - Distinguish test reports filed in different stages and parallel branches in Pipeline.
  • PR #84 - Prevent unsafe cast to TestResult
  • PR #82 - Enable population of errorDetails for unit testing purposes

Version 1.21 (Aug 4 2017)

  • PR #65: Do not register XMLEntityResolver as a global extension
  • PR #69: Fix a file descriptor leak
  • PR #71: Expose test data publicly
  • PR #77: Improve test results table readability

Version 1.20 (Feb 13 2017)

  • JENKINS-41134 Incorrect reporting of multiple test results in some cases using Pipeline.
  • JENKINS-29736 Incorrect vertical axis values in test duration graph.

Version 1.19 (Oct 17 2016)

  • JENKINS-32148 Highlight test result lines on hover.
  • PR #49 Do not bury 'AllowEmptyResults' configuration option in Advanced.
  • PR #56 Add '<' and '>' as unsafe URI characters.

Version 1.18 (Aug 08 2016; 1.16 & 1.17 were botched)

  • Symbol added in 1.15 did not work in Jenkins 1.x.

Version 1.15 (Jul 12 2016)

  • Integrate Symbol annotation.

Version 1.14 (Jul 5 2016)

  • JENKINS-28784 make TestDataPublisher work in Pipeline.
  • PR #46 Option to cap, or at least log, number of iterations of AbstractTestResultAction.buildDataSet.
  • PR #45 Prevent wrapping for test name table cell.

Version 1.13 (May 1 2016)

Version 1.12 (Apr 20 2016)

  • PR #36 Resolve occurrences of Sonar rule "UselessParenthesesCheck - Useless parentheses around expressions should be removed to prevent any misunderstanding" (see this)
  • PR #35 Testsuite duration may be parsed from time attr.
  • JENKINS-33343 Upgrade to parent POM 2.x

Version 1.11 (Feb 25 2016)

  • Testsuite duration can be retrieved from its time attribute if it exists
  • Remove the glitch symbol in the JUnitResultArchiver configuration

Version 1.10 (Dec 10 2015)

  • (info) JENKINS-12815 Added Job Configuration Option allowing to NOT fail JUnit Report publish when no xml report files
  • (info) PR #23 Remove ambiguity between empty and unreadable files
  • (plus) PR #24 Add API allowing to access passed and skipped tests

Version 1.9 (Sep 3 2015)

  • Export TestActions on the TestObject to make them accessible via the REST API
  • JENKINS-24352 JUnit test result table wrapping duration text

Version 1.8 (Jul 29 2015)

  • JENKINS-29613 Failure summary jumps to the top of the page when expanded/collapsed.

Version 1.7 (Jul 17 2015)

Version 1.6 (May 01 2015)

  • JENKINS-26077 Duplicated result links when using the xUnit plugin.
  • JENKINS-27974 Unusable URL produced when classname field in results was empty.

Version 1.5 (Mar 11 2015)

  • Trim stdio even on failing tests, just to a 100× larger cutoff.
  • Diagnostics for an infinite loop.
  • Corrected help text.
  • Japanese translation edits.

Version 1.4 (Feb 04 2015)

  • NPE not known to affect actual usage but blocking tests of JENKINS-25446.

Version 1.3 (Dec 03 2014) (requires 1.580.1+)

  • JENKINS-25573 Health score factor did not work.
  • Repeated archiving fix in 1.2-beta-2 did not work on slaves.
  • JENKINS-24580 Older and newer links were swapped in the display.

Version 1.2 (Nov 06 2014)

Version 1.2-beta-4 (Nov 04 2014)

  • JENKINS-25375 Restore deprecated method override for binary compatibility.

Version 1.2-beta-3 (Oct 25 2014)

Version 1.2-beta-2 (Oct 20 2014)

  • Permit the archive step to be run multiple times on the same build, aggregating results. (Applicable from workflows, not from normal usage as a publisher in a freestyle project.)
  • Some configuration fields could not be set in 1.2-beta-1.
  • Typos in some text, and German localization fixes.
  • Do not show form validation errors when used from a non-freestyle context.
  • Ignore a noisy AccessDeniedException when listing jobs.

Version 1.2-beta-1 (Aug 25 2014)

Version 1.1 (Aug 25 2014)

  • Marked as dependent on 1.577, so 1.575/1.576 users should not install it.

Version 1.0 (Aug 11 2014)

Initial version after split.