0
0
Jenkinsdevops~10 mins

Code coverage reports in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to publish a code coverage report using the Jenkins pipeline.

Jenkins
publishCoverage adapters: [coberturaAdapter('**/[1]')], sourceFileResolver: sourceFiles('NEVER_STORE')
Drag options to blanks, or click blank then click option'
Acoverage.xml
Bresults.xml
Creport.xml
Doutput.xml
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong filename for the coverage report.
Forgetting to include the file extension.
2fill in blank
medium

Complete the Jenkins pipeline step to fail the build if coverage is below the threshold.

Jenkins
step([$class: 'CoveragePublisher', failUnhealthy: true, [1]: 80])
Drag options to blanks, or click blank then click option'
AcoverageThreshold
BcoverageMinimum
CcoverageLimit
DminimumCoverage
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect parameter names that cause the step to ignore the threshold.
Misspelling the parameter name.
3fill in blank
hard

Fix the error in the Jenkins pipeline snippet to correctly archive the coverage report.

Jenkins
archiveArtifacts artifacts: '[1]', fingerprint: true
Drag options to blanks, or click blank then click option'
Acoverage-report.xml
Bcoverage.json
Creport.txt
Dcoverage.xml
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong file extension or filename.
Archiving a non-existent file.
4fill in blank
hard

Fill both blanks to configure the Jenkins pipeline to publish and fail on low coverage.

Jenkins
publishCoverage adapters: [[1]('**/coverage.xml')], failUnhealthy: [2]
Drag options to blanks, or click blank then click option'
AcoberturaAdapter
Btrue
Cfalse
DjacocoAdapter
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong adapter for the coverage report.
Setting failUnhealthy to false or missing it.
5fill in blank
hard

Fill all three blanks to create a Jenkins pipeline snippet that collects coverage, archives the report, and sets a threshold.

Jenkins
publishCoverage adapters: [[1]('**/coverage.xml')]
archiveArtifacts artifacts: '[2]'
step([$class: 'CoveragePublisher', [3]: 75])
Drag options to blanks, or click blank then click option'
AcoberturaAdapter
Bcoverage.xml
CcoverageThreshold
DjacocoAdapter
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong adapter or filename.
Misspelling the threshold parameter.