0
0
Jenkinsdevops~10 mins

Integration test stages in Jenkins - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Integration test stages
Start Pipeline
Checkout Code
Build Application
Run Unit Tests
Run Integration Tests
Publish Test Results
Deploy or Notify
End
This flow shows the main stages of a Jenkins pipeline running integration tests after building and unit testing the application.
Execution Sample
Jenkins
pipeline {
  agent any
  stages {
    stage('Integration Test') {
      steps {
        sh 'run-integration-tests.sh'
      }
    }
  }
}
This Jenkins pipeline stage runs integration tests by executing a shell script.
Process Table
StepStageActionResultNext Step
1Start PipelineInitialize Jenkins jobJob startedCheckout Code
2Checkout CodePull code from repositoryCode available locallyBuild Application
3Build ApplicationCompile and package appBuild successfulRun Unit Tests
4Run Unit TestsExecute unit testsAll unit tests passedRun Integration Tests
5Run Integration TestsExecute integration tests scriptIntegration tests passedPublish Test Results
6Publish Test ResultsArchive and display test reportsReports publishedDeploy or Notify
7Deploy or NotifyDeploy app or send notificationsDeployment done or notifiedEnd
8EndPipeline finishedSuccessNone
💡 Pipeline ends after deployment or notification stage completes successfully.
Status Tracker
VariableStartAfter 1After 2After 3After 4After 5After 6Final
pipeline_statusNot startedStartedCode checked outBuiltUnit tests passedIntegration tests passedResults publishedDeployed/Notified
integration_test_resultNot runNot runNot runNot runNot runPassedPassedPassed
Key Moments - 2 Insights
Why do integration tests run after unit tests and not before?
Integration tests depend on the application being built and unit tests passing first, as shown in execution_table rows 4 and 5 where unit tests pass before integration tests run.
What happens if integration tests fail during the pipeline?
If integration tests fail, the pipeline stops before publishing results or deployment, preventing broken code from progressing, as implied by the flow stopping after step 5 if tests fail.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the pipeline_status after step 4?
ABuilt
BIntegration tests passed
CUnit tests passed
DCode checked out
💡 Hint
Check variable_tracker row for pipeline_status at After 4 column.
At which step does the integration test script run?
AStep 3
BStep 5
CStep 4
DStep 6
💡 Hint
Look at execution_table Stage and Action columns for running integration tests.
If integration tests fail, what is the likely next step in the pipeline?
APipeline stops
BDeploy or Notify
CPublish Test Results
DRun Unit Tests again
💡 Hint
Refer to key_moments explanation about pipeline stopping on test failure.
Concept Snapshot
Jenkins pipeline stages for integration tests:
- Checkout code
- Build application
- Run unit tests
- Run integration tests
- Publish results
- Deploy or notify
Integration tests run after unit tests and build succeed.
Full Transcript
This visual execution shows a Jenkins pipeline running integration tests. The pipeline starts by checking out code, building the app, and running unit tests. If unit tests pass, it runs integration tests by executing a shell script. After integration tests pass, it publishes test results and then deploys the app or sends notifications. Variables like pipeline_status and integration_test_result update at each stage. If integration tests fail, the pipeline stops to prevent faulty code from deploying.