testsPublishResults¶
Description¶
This step can publish test results from various sources.
Prerequisites¶
- test result files - To use this step, there must be test result files available.
- installed plugins:
- junit
- jacoco
- cobertura
- performance
Pipeline configuration¶
none
Explanation of pipeline step¶
Usage of pipeline step:
testsPublishResults(
junit: [updateResults: true, archive: true],
jacoco: [archive: true]
)
Parameters¶
name | mandatory | default | possible values |
---|---|---|---|
cobertura |
no | [pattern:**/target/coverage/**/cobertura-coverage.xml, onlyStableBuilds:true, allowEmptyResults:true, archive:false, active:false] |
true , false , Map |
cucumber |
no | [pattern:**/e2e/*.json, allowEmptyResults:true, archive:false, active:false] |
true , false , Map |
failOnError |
no | false |
true , false |
htmlPublisher |
no | [allowMissing:true, alwaysLinkToLastBuild:false, keepAll:true, reportDir:, pattern:**/reports/coverage-reports/**/index.html, reportName:Results, active:false] |
true , false , Map |
jacoco |
no | [pattern:**/target/*.exec, allowEmptyResults:true, archive:false, active:false] |
true , false , Map |
jmeter |
no | [pattern:**/*.jtl, filterRegex:, errorFailedThreshold:20, errorUnstableThreshold:10, errorUnstableResponseTimeThreshold:, relativeFailedThresholdPositive:0, relativeFailedThresholdNegative:0, relativeUnstableThresholdPositive:0, relativeUnstableThresholdNegative:0, modeOfThreshold:false, modeThroughput:false, nthBuildNumber:0, configType:PRT, failBuildIfNoResultFile:false, compareBuildPrevious:true, allowEmptyResults:true, archive:false, active:false] |
true , false , Map |
junit |
no | [pattern:**/TEST-*.xml, updateResults:false, allowEmptyResults:true, archive:false, active:false] |
true , false , Map |
script |
yes |
cobertura
- Publishes code coverage with the Cobertura plugin.cucumber
- Publishes test results with the Cucumber plugin.failOnError
- If it is set totrue
the step will fail the build if JUnit detected any failing tests.htmlPublisher
- Publishes test results with the HTML Publisher plugin.jacoco
- Publishes code coverage with the JaCoCo plugin.jmeter
- Publishes performance test results with the Performance plugin.junit
- Publishes test results files in JUnit format with the JUnit Plugin.script
- The common script environment of the Jenkinsfile running. Typically the reference to the script calling the pipeline step is provided with thethis
parameter, as inscript: this
. This allows the function to access thecommonPipelineEnvironment
for retrieving, e.g. configuration parameters.
junit¶
parameter | mandatory | default | possible values |
---|---|---|---|
pattern | no | '**/TEST-*.xml' |
|
archive | no | false |
true, false |
updateResults | no | false |
true, false |
allowEmptyResults | no | true |
true, false |
jacoco¶
parameter | mandatory | default | possible values |
---|---|---|---|
pattern | no | '**/target/*.exec' |
|
include | no | '' |
'**/*.class' |
exclude | no | '' |
'**/Test*' |
archive | no | false |
true, false |
allowEmptyResults | no | true |
true, false |
cobertura¶
parameter | mandatory | default | possible values |
---|---|---|---|
pattern | no | '**/target/coverage/cobertura-coverage.xml' |
|
archive | no | false |
true, false |
allowEmptyResults | no | true |
true, false |
onlyStableBuilds | no | true |
true, false |
jmeter¶
parameter | mandatory | default | possible values |
---|---|---|---|
pattern | no | '**/*.jtl' |
|
errorFailedThreshold | no | 20 |
|
errorUnstableThreshold | no | 10 |
|
errorUnstableResponseTimeThreshold | no | `` | |
relativeFailedThresholdPositive | no | 0 |
|
relativeFailedThresholdNegative | no | 0 |
|
relativeUnstableThresholdPositive | no | 0 |
|
relativeUnstableThresholdNegative | no | 0 |
|
modeOfThreshold | no | false |
true, false |
modeThroughput | no | false |
true, false |
nthBuildNumber | no | 0 |
|
configType | no | PRT |
|
failBuildIfNoResultFile | no | false |
true, false |
compareBuildPrevious | no | true |
true, false |
archive | no | false |
true, false |
allowEmptyResults | no | true |
true, false |
filterRegex | no | ' ' |
Step configuration¶
We recommend to define values of step parameters via config.yml file.
In following sections of the config.yml the configuration is possible:
parameter | general | step/stage |
---|---|---|
cobertura |
X | X |
cucumber |
X | X |
failOnError |
X | |
htmlPublisher |
X | X |
jacoco |
X | X |
jmeter |
X | X |
junit |
X | X |
script |
Dependencies¶
The step depends on the following Jenkins plugins
- cobertura
- cucumber-testresult-plugin
- htmlpublisher
- jacoco
- junit
- performance
- pipeline-utility-steps
- workflow-basic-steps
- workflow-cps-global-lib
Transitive dependencies are omitted.
The list might be incomplete.
Consider using the ppiper/jenkins-master docker image. This images comes with preinstalled plugins.
Side effects¶
none
Exceptions¶
none
Example¶
// publish test results with coverage
testsPublishResults(
junit: [updateResults: true, archive: true],
jacoco: [archive: true]
)
// publish test results with coverage
testsPublishResults(
junit: [pattern: '**/target/TEST*.xml', archive: true],
cobertura: [pattern: '**/target/coverage/cobertura-coverage.xml']
)