CDP Testing & Quality Assurance 1 — Questions and Answers
Question 1: Which testing approach aligns best with DevOps principles by integrating testing throughout the entire software delivery pipeline?
- Shift-left testing (Correct answer)
- Waterfall testing
- Manual regression testing
- End-of-cycle UAT
Correct answer: Shift-left testing
Shift-left testing moves quality checks earlier in the pipeline, catching defects sooner and reducing the cost of fixes in a DevOps workflow.
Question 2: In a DevOps pipeline, what is the primary purpose of a quality gate?
- To slow down deployments for manual review
- To enforce minimum quality criteria before promoting code to the next stage (Correct answer)
- To generate test reports for stakeholders
- To replace unit tests with integration tests
Correct answer: To enforce minimum quality criteria before promoting code to the next stage
Quality gates enforce minimum standards (coverage thresholds, zero critical bugs, etc.) that must be met before code advances to the next pipeline stage.
Question 3: Which type of test validates that individual functions or methods work correctly in isolation?
- Integration test
- Smoke test
- Unit test (Correct answer)
- End-to-end test
Correct answer: Unit test
Unit tests target the smallest testable units of code in isolation, providing fast feedback to developers without external dependencies.
Question 4: What does TDD (Test-Driven Development) require developers to do before writing production code?
- Deploy to a staging environment
- Write a failing test first (Correct answer)
- Review code with a peer
- Create a deployment plan
Correct answer: Write a failing test first
TDD follows the Red-Green-Refactor cycle: write a failing test, write the minimum code to pass it, then refactor for quality.
Question 5: Which metric measures the percentage of code exercised by automated tests?
- Defect escape rate
- Mean time to recovery
- Code coverage (Correct answer)
- Deployment frequency
Correct answer: Code coverage
Code coverage measures what percentage of the codebase is executed during automated test runs, helping teams identify untested areas.
Question 6: In the DevOps testing pyramid, which layer should contain the largest number of tests?
- UI/End-to-end tests
- Service/Integration tests
- Unit tests (Correct answer)
- Manual exploratory tests
Correct answer: Unit tests
The testing pyramid places the most tests at the unit level because they are fast, cheap, and stable compared to higher-level tests.
Question 7: What is the main benefit of running automated tests in parallel during a CI pipeline?
- Reduces the number of test cases needed
- Shortens overall pipeline execution time (Correct answer)
- Eliminates the need for integration tests
- Increases code coverage automatically
Correct answer: Shortens overall pipeline execution time
Parallel test execution distributes the test suite across multiple runners simultaneously, significantly reducing total pipeline run time and enabling faster feedback.
Which testing approach aligns best with DevOps principles by integrating testing throughout the entire software delivery pipeline?