The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

JUnit Plugin

junit: Archive JUnit-formatted test results

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 historical test result trends, a web UI for viewing test reports, tracking failures, and so on.

To use this feature, first set up your build to run tests, then 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.

  • testResults : String
  • allowEmptyResults : boolean (optional)
    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.
  • checksName : String (optional)
    If provided, and publishing checks enabled, the plugin will use this name when publishing results to corresponding SCM hosting platforms. If not, a default including the current stage / branch names will be used.
  • healthScaleFactor : double (optional)
    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.
    • A factor of 0.1 means that 10% of tests failing will score 99% health
    • A factor of 0.5 means that 10% of tests failing will score 95% health
    • A factor of 1.0 means that 10% of tests failing will score 90% health
    • A factor of 2.0 means that 10% of tests failing will score 80% health
    • A factor of 2.5 means that 10% of tests failing will score 75% health
    • A factor of 5.0 means that 10% of tests failing will score 50% health
    • A factor of 10.0 means that 10% of tests failing will score 0% health
    The factor is persisted with the build results, so changes will only be reflected in new builds.
  • keepLongStdio : boolean (optional)
    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!
  • keepProperties : boolean (optional)
  • skipMarkingBuildUnstable : boolean (optional)
    If this option is unchecked, then the plugin will mark the build as unstable when it finds at least 1 test failure. If this option is checked, then the build will still be successful even if there are test failures reported. In any case, the corresponding pipeline node (and stage) will be marked as unstable in case of test failure.
  • skipOldReports : boolean (optional)
  • skipPublishingChecks : boolean (optional)
    If this option is unchecked, then the plugin automatically publishes the test results to corresponding SCM hosting platforms. For example, if you are using this feature for a GitHub organization project, the warnings will be published to GitHub through the Checks API. If this operation slows down your build, or you don't want to publish the warnings to SCM platforms, you can use this option to deactivate this feature.
  • testDataPublishers (optional)
      Array / List of Nested Choice of Objects
    • attachments
      • $class: 'AutomateTestDataPublisher'
        • $class: 'ClaimTestDataPublisher'
          • $class: 'JUnitFlakyTestDataPublisher'
            • $class: 'JunitResultPublisher'
              If checked, each JUnit test result XML file will be examined to see if it represents a SOASTA CloudTest composition. For applicable tests, a hyperlink to the SOASTA CloudTest dashboard will be inserted into the test report.
              • urlOverride : String
                Specify the CloudTest URL to use when creating hyperlinks to CloudTest dashboards. Normally, this can be left blank, and the URL will be extracted from the test result file.
            • $class: 'PerfSigTestDataPublisher'
              • dynatraceProfile : String
            • $class: 'SahaginTestDataPublishser'
              • $class: 'SauceOnDemandReportPublisher'
                Show embedded Sauce OnDemand reports, including video and logs. Your test should use Selenium client factory (at least version 1.3 to match test cases to individual Sauce OnDemand jobs).
                • jobVisibility : String (optional)
                  Set your test results visibility permissions. The Sauce Documentation has all the various levels described in detail.
              • $class: 'StabilityTestDataPublisher'
                • $class: 'TestCafePublisher'
                  • $class: 'TestReporter'
                    • $class: 'YoutrackTestDataPublisher'

                    step([$class: 'JUnitResultArchiver']): Publish JUnit test result report

                    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 historical test result trends, a web UI for viewing test reports, tracking failures, and so on.

                    To use this feature, first set up your build to run tests, then 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.

                    • testResults : String
                    • allowEmptyResults : boolean (optional)
                      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.
                    • checksName : String (optional)
                      If provided, and publishing checks enabled, the plugin will use this name when publishing results to corresponding SCM hosting platforms. If not, a default of "Tests" will be used.
                    • healthScaleFactor : double (optional)
                      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.
                      • A factor of 0.1 means that 10% of tests failing will score 99% health
                      • A factor of 0.5 means that 10% of tests failing will score 95% health
                      • A factor of 1.0 means that 10% of tests failing will score 90% health
                      • A factor of 2.0 means that 10% of tests failing will score 80% health
                      • A factor of 2.5 means that 10% of tests failing will score 75% health
                      • A factor of 5.0 means that 10% of tests failing will score 50% health
                      • A factor of 10.0 means that 10% of tests failing will score 0% health
                      The factor is persisted with the build results, so changes will only be reflected in new builds.
                    • keepLongStdio : boolean (optional)
                      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!
                    • keepProperties : boolean (optional)
                    • skipMarkingBuildUnstable : boolean (optional)
                      If this option is unchecked, then the plugin will mark the build as unstable when it finds at least 1 test failure. If this option is checked, then the build will still be successful even if there are test failures reported.
                    • skipOldReports : boolean (optional)
                    • skipPublishingChecks : boolean (optional)
                      If this option is unchecked, then the plugin automatically publishes the test results to corresponding SCM hosting platforms. For example, if you are using this feature for a GitHub organization project, the warnings will be published to GitHub through the Checks API. If this operation slows down your build, or you don't want to publish the warnings to SCM platforms, you can use this option to deactivate this feature.
                    • testDataPublishers (optional)
                        Array / List of Nested Choice of Objects
                      • attachments
                        • $class: 'AutomateTestDataPublisher'
                          • $class: 'ClaimTestDataPublisher'
                            • $class: 'JUnitFlakyTestDataPublisher'
                              • $class: 'JunitResultPublisher'
                                If checked, each JUnit test result XML file will be examined to see if it represents a SOASTA CloudTest composition. For applicable tests, a hyperlink to the SOASTA CloudTest dashboard will be inserted into the test report.
                                • urlOverride : String
                                  Specify the CloudTest URL to use when creating hyperlinks to CloudTest dashboards. Normally, this can be left blank, and the URL will be extracted from the test result file.
                              • $class: 'PerfSigTestDataPublisher'
                                • dynatraceProfile : String
                              • $class: 'SahaginTestDataPublishser'
                                • $class: 'SauceOnDemandReportPublisher'
                                  Show embedded Sauce OnDemand reports, including video and logs. Your test should use Selenium client factory (at least version 1.3 to match test cases to individual Sauce OnDemand jobs).
                                  • jobVisibility : String (optional)
                                    Set your test results visibility permissions. The Sauce Documentation has all the various levels described in detail.
                                • $class: 'StabilityTestDataPublisher'
                                  • $class: 'TestCafePublisher'
                                    • $class: 'TestReporter'
                                      • $class: 'YoutrackTestDataPublisher'

                                      Was this page helpful?

                                      Please submit your feedback about this page through this quick form.

                                      Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

                                          


                                      See existing feedback here.