0
0
Testing Fundamentalstesting~20 mins

Pipeline stages and test gates in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Pipeline Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Pipeline Stages

Which of the following best describes the purpose of the build stage in a software pipeline?

AIt monitors application performance after deployment.
BIt deploys the application to the production environment.
CIt runs automated tests to verify code correctness.
DIt compiles the source code and creates executable artifacts.
Attempts:
2 left
💡 Hint

Think about what happens before testing and deployment.

assertion
intermediate
2:00remaining
Test Gate Logic in Pipeline

In a pipeline, a test gate is configured to fail the pipeline if any unit test fails. Given the following test results, what will be the pipeline outcome?

Unit tests passed: 95/100
Integration tests passed: 50/50
APipeline passes because most unit tests passed.
BPipeline passes because integration tests passed.
CPipeline fails because some unit tests failed.
DPipeline fails because integration tests are mandatory.
Attempts:
2 left
💡 Hint

Test gates often require 100% pass rate for critical tests.

Predict Output
advanced
2:00remaining
Pipeline Stage Execution Order

Consider this simplified pipeline stage execution code snippet:

stages = ['build', 'test', 'deploy']
results = []
for stage in stages:
    if stage == 'test':
        results.append('test skipped')
        break
    results.append(stage + ' completed')
print(results)

What is the output after running this code?

A['build completed', 'test skipped']
B['build completed']
C['build completed', 'test completed', 'deploy completed']
D['test skipped']
Attempts:
2 left
💡 Hint

Note the break statement inside the loop.

🔧 Debug
advanced
2:00remaining
Debugging a Test Gate Failure

A pipeline test gate is supposed to block deployment if code coverage is below 80%. The following code snippet is used to check coverage:

coverage = 78
if coverage < 80:
    print('Pass test gate')
else:
    print('Fail test gate')

Why does the pipeline allow deployment even when coverage is 78%?

ABecause 78 is less than 80, so it should fail but the code logic is reversed.
BBecause the condition uses '>' instead of '>=' causing 80% to fail but 78% to pass.
CBecause the condition only passes if coverage is strictly greater than 80, so 78 fails and blocks deployment.
DBecause the code prints 'Fail test gate' when coverage is below 80%, so deployment is blocked.
Attempts:
2 left
💡 Hint

Check the logic of the if-else condition carefully.

framework
expert
3:00remaining
Designing a Test Gate for Multiple Criteria

You want to design a test gate that blocks deployment if any of these conditions fail:

  • All unit tests pass
  • Code coverage is at least 85%
  • No critical bugs are open

Which of the following pseudocode snippets correctly implements this test gate?

unit_tests_passed = True
coverage = 87
critical_bugs_open = 0
if ???:
    print('Pass test gate')
else:
    print('Fail test gate')
Aif unit_tests_passed or coverage >= 85 or critical_bugs_open == 0:
Bif unit_tests_passed and coverage >= 85 and critical_bugs_open == 0:
Cif not unit_tests_passed and coverage < 85 and critical_bugs_open > 0:
Dif unit_tests_passed and coverage > 85 and critical_bugs_open != 0:
Attempts:
2 left
💡 Hint

All conditions must be true to pass the gate.