jenkinsci / junit-plugin

Allows JUnit-format test results to be published
https://plugins.jenkins.io/junit
MIT License
76 stars 337 forks source link
hacktoberfest jenkins jenkins-plugin junit

JUnit Plugin for Jenkins

Jenkins Plugin GitHub release Jenkins Plugin Installs

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.

The plugin also provides a generic API for other unit-test publisher plugins in Jenkins. This functionality was part of the Jenkins Core until it was split out to this plugin in version in 1.577.

Configuration

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 result checks (for GitHub projects)

:warning: This feature requires:

If not disabled in the job configuration, this plugin will publish test results to GitHub through GitHub checks API.

In the Details view of each check (example), test results will be displayed.

checks

In order to disable the checks feature, set the property skipPublishingChecks to true:

junit skipPublishingChecks: true, testResults: 'test-results.xml'

The plugin will default to using the stage name or branch of a parallel step prepended by Tests for the checks name. If there are no enclosing stages or branches, Tests will be used. The name can also be overridden by a withChecks step.

The following snippet would publish three checks with the names Tests / Integration, Tests and Integration Tests, respectively.

stage('Integration') {
  junit 'test-results.xml'
}

junit 'more-test-results.xml'

stage('Ignored') {
  withChecks('Integration Tests') {
    junit 'yet-more-test-results.xml'
  }
}

Contributing

Refer to our contribution guidelines