0
0
Jenkinsdevops~10 mins

Integration test stages 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 define a Jenkins stage named 'Integration Test'.

Jenkins
stage('[1]') {
    steps {
        echo 'Running integration tests'
    }
}
Drag options to blanks, or click blank then click option'
ABuild
BIntegration Test
CDeploy
DTest
Attempts:
3 left
💡 Hint
Common Mistakes
Using a generic stage name like 'Test' instead of 'Integration Test'.
Misspelling the stage name.
2fill in blank
medium

Complete the code to run the integration test script using a shell command.

Jenkins
stage('Integration Test') {
    steps {
        sh '[1]'
    }
}
Drag options to blanks, or click blank then click option'
A./run_integration_tests.sh
Brun_tests.sh
Cintegration_test.py
Dnpm test
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting './' which may cause the script not to be found.
Using a Python or npm command instead of the shell script.
3fill in blank
hard

Fix the error in the Jenkins pipeline snippet to correctly archive the test results.

Jenkins
stage('Integration Test') {
    steps {
        archiveArtifacts [1]
    }
}
Drag options to blanks, or click blank then click option'
A'test-results/*.xml'
B**/test-results/*.xml
C'**/test-results/*.xml'
Dtest-results/*.xml
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the pattern string causing syntax errors.
Using a pattern without '**/' which misses nested files.
4fill in blank
hard

Fill both blanks to define a post action that always runs to clean the workspace after integration tests.

Jenkins
stage('Integration Test') {
    steps {
        sh './run_integration_tests.sh'
    }
    post {
        [1] {
            [2] {
                cleanWs()
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Aalways
Bsuccess
Cscript
Dfailure
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'success' or 'failure' which only run conditionally.
Omitting 'script' causing syntax errors.
5fill in blank
hard

Fill all three blanks to define a Jenkins pipeline stage that runs integration tests, archives results, and cleans workspace on failure.

Jenkins
stage('[1]') {
    steps {
        sh '[2]'
    }
    post {
        failure {
            [3] {
                cleanWs()
            }
        }
        success {
            archiveArtifacts '**/test-results/*.xml'
        }
    }
}
Drag options to blanks, or click blank then click option'
AIntegration Test
B./run_integration_tests.sh
Cscript
Dalways
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'always' instead of 'failure' for cleanup.
Not quoting the stage name.
Omitting './' in the shell command.