0
0
Testing Fundamentalstesting~10 mins

Continuous testing in CI/CD 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 run tests automatically after each code commit.

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

Complete the code to specify the testing stage in a Jenkinsfile.

Testing Fundamentals
stage('Test') {
  steps {
    [1] 'pytest tests/'
  }
}
Drag options to blanks, or click blank then click option'
Ash
Becho
Cbat
Dinput
Attempts:
3 left
💡 Hint
Common Mistakes
Using echo which only prints text.
Using input which waits for user input.
3fill in blank
hard

Fix the error in the GitHub Actions workflow to run tests on push.

Testing Fundamentals
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Run tests
        run: [1]
Drag options to blanks, or click blank then click option'
Anpm test
Bnpm deploy
Cnpm build
Dnpm start
Attempts:
3 left
💡 Hint
Common Mistakes
Using npm build which builds the project but does not test.
Using npm start which runs the app but not tests.
4fill in blank
hard

Fill both blanks to create a Python dictionary comprehension that includes only tests with names starting with 'test_'.

Testing Fundamentals
test_dict = {test: result for test, result in test_results.items() if test [1] '[2]'}
Drag options to blanks, or click blank then click option'
Astartswith
Btest_
Cendswith
Dcontains
Attempts:
3 left
💡 Hint
Common Mistakes
Using endswith or contains which do not match the requirement.
Forgetting to put quotes around the string 'test_'.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase test names to their results if the result is 'passed'.

Testing Fundamentals
passed_tests = [1]: [2] for [3], result in test_results.items() if result == 'passed'
Drag options to blanks, or click blank then click option'
Atest.upper()
Bresult
Ctest
Dtest.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using test.lower() instead of uppercase.
Mixing up keys and values in the comprehension.