0
0
Testing Fundamentalstesting~10 mins

Why CI/CD integrates testing into delivery in Testing Fundamentals - Test Your Understanding

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

Complete the code to define a CI/CD pipeline step that runs tests automatically.

Testing Fundamentals
pipeline {
  stages {
    stage('Test') {
      steps {
        sh '[1]'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Anpm test
Bnpm run build
Cnpm deploy
Dnpm install
Attempts:
3 left
💡 Hint
Common Mistakes
Using build or deploy commands instead of test
Forgetting to run tests in the pipeline
2fill in blank
medium

Complete the code to add a test stage that runs only if the build stage succeeds.

Testing Fundamentals
pipeline {
  stages {
    stage('Build') {
      steps {
        sh 'make build'
      }
    }
    stage('Test') {
      when {
        [1] 'Build'
      }
      steps {
        sh 'make test'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Abranch
Benvironment
Cstage
Dinput
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'branch' or 'environment' instead of 'stage'
Not adding any condition to run tests after build
3fill in blank
hard

Fix the error in the test command to ensure tests run correctly in the CI/CD pipeline.

Testing Fundamentals
steps {
  sh '[1]'
}
Drag options to blanks, or click blank then click option'
Anpm test --watch
Bnpm test --ci
Cnpm test --silent
Dnpm test --coverage
Attempts:
3 left
💡 Hint
Common Mistakes
Using watch mode which waits for changes
Not using CI-specific flags causing pipeline to hang
4fill in blank
hard

Fill both blanks to create a test report file and archive it after tests run.

Testing Fundamentals
steps {
  sh 'pytest > [1]'
  archiveArtifacts '[2]'
}
Drag options to blanks, or click blank then click option'
Atest-results.txt
Btest-results.xml
Attempts:
3 left
💡 Hint
Common Mistakes
Using different filenames for output and archive
Archiving a non-existent file
5fill in blank
hard

Fill all three blanks to define a pipeline that builds, tests, and deploys only if tests pass.

Testing Fundamentals
pipeline {
  stages {
    stage('Build') {
      steps {
        sh '[1]'
      }
    }
    stage('Test') {
      steps {
        sh '[2]'
      }
    }
    stage('Deploy') {
      when {
        [3] 'Test'
      }
      steps {
        sh 'deploy.sh'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Amake build
Bmake test
Cstage
Dmake deploy
Attempts:
3 left
💡 Hint
Common Mistakes
Deploying without checking test success
Mixing up commands for build and test