0
0
Testing Fundamentalstesting~10 mins

Continuous Integration testing in Testing Fundamentals - 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 basic CI pipeline step that runs tests.

Testing Fundamentals
pipeline {
  stages {
    stage('Test') {
      steps {
        sh '[1]'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Apytest
Bclean
Cbuild
Ddeploy
Attempts:
3 left
💡 Hint
Common Mistakes
Using build or deploy commands instead of test commands.
2fill in blank
medium

Complete the code to trigger the CI pipeline on every push to the main branch.

Testing Fundamentals
on:
  push:
    branches:
      - '[1]'
Drag options to blanks, or click blank then click option'
Afeature
Bdevelop
Cmain
Drelease
Attempts:
3 left
💡 Hint
Common Mistakes
Using feature or develop branches which are not main branches.
3fill in blank
hard

Fix the error in the test script command to correctly run tests in CI.

Testing Fundamentals
steps:
  - name: Run tests
    run: [1]
Drag options to blanks, or click blank then click option'
Anpm deploy
Bnpm run test
Cnpm build
Dnpm testt
Attempts:
3 left
💡 Hint
Common Mistakes
Typo in the test command causing failure.
4fill in blank
hard

Fill both blanks to define a test stage that runs tests only if the code is pushed to the main branch.

Testing Fundamentals
stages:
  - name: Test
    if: contains([1], '[2]')
    steps:
      - run: pytest
Drag options to blanks, or click blank then click option'
Agithub.ref
Bmain
Cdevelop
Dgithub.event_name
Attempts:
3 left
💡 Hint
Common Mistakes
Using event name instead of branch ref, or wrong branch name.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps test names to their pass status if the test duration is less than 5 seconds.

Testing Fundamentals
test_results = { [1]: results[[2]]['passed'] for [1] in results if results[[2]]['duration'] [3] 5 }
Drag options to blanks, or click blank then click option'
Atest_name
B'test_name'
C<
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using string keys instead of variable, or wrong comparison operator.