0
0
Jenkinsdevops~10 mins

Test result trends 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 enable test result trend reporting in Jenkins pipeline.

Jenkins
post {
  always {
    junit '[1]'
  }
}
Drag options to blanks, or click blank then click option'
Acoverage-report/*.html
Btest-results/*.xml
Cbuild.log
Dartifact.zip
Attempts:
3 left
💡 Hint
Common Mistakes
Using a log file path instead of test result XML files.
Using coverage reports or artifacts instead of test results.
2fill in blank
medium

Complete the code to archive test result reports after the build.

Jenkins
archiveArtifacts artifacts: '[1]', fingerprint: true
Drag options to blanks, or click blank then click option'
Atest-results/*.xml
Boutput/*.txt
Ccoverage/*.html
Dbuild.log
Attempts:
3 left
💡 Hint
Common Mistakes
Archiving log files or unrelated reports instead of test results.
Using incorrect file patterns.
3fill in blank
hard

Fix the error in the pipeline code to correctly publish test result trends.

Jenkins
pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        sh 'run-tests.sh'
      }
    }
  }
  post {
    always {
      junit '[1]'
    }
  }
}
Drag options to blanks, or click blank then click option'
Atest-results/*.xml
Btest-results/*.txt
Creports/*.xml
Dbuild.log
Attempts:
3 left
💡 Hint
Common Mistakes
Using text or log files instead of XML files.
Using wrong folder paths.
4fill in blank
hard

Fill both blanks to create a map of test names to their pass/fail status for trend analysis.

Jenkins
def testStatus = [[1]: [2] for test in tests]
Drag options to blanks, or click blank then click option'
Atest.name
Btest.status
Ctest.result
Dtest.id
Attempts:
3 left
💡 Hint
Common Mistakes
Using test IDs instead of names as keys.
Using incorrect properties for status.
5fill in blank
hard

Fill all three blanks to filter and map only failed tests for detailed reporting.

Jenkins
def failedTests = [[1]: [2] for [3] in tests if [2] == 'FAILED']
Drag options to blanks, or click blank then click option'
Atest.name
Btest.status
Ctest
Dresult
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names in the loop.
Filtering on incorrect status values.