CAD Continuous Integration and Testing 2 — Questions and Answers
Question 1: In CI, what does a 'broken build' notification ideally trigger first?
- Immediate team meeting
- Automatic rollback to previous build
- Developer who broke the build fixes it before committing more code (Correct answer)
- Manager escalation report
Correct answer: Developer who broke the build fixes it before committing more code
The developer responsible for the failing commit should stop other work and fix the build immediately to unblock the team.
Question 2: Which metric best indicates the health of a CI pipeline over time?
- Number of commits per day
- Mean time to restore a broken build (Correct answer)
- Total lines of code added
- Number of pull requests merged
Correct answer: Mean time to restore a broken build
Mean time to restore (MTTR) reflects how quickly the team responds to and resolves build failures.
Question 3: What is 'test flakiness' in the context of CI?
- Tests that take too long to run
- Tests that randomly pass or fail without code changes (Correct answer)
- Tests written by junior developers
- Tests lacking assertions
Correct answer: Tests that randomly pass or fail without code changes
Flaky tests produce inconsistent results, eroding trust in the CI pipeline and hiding real failures.
Question 4: A team notices their CI build takes 45 minutes. What is the recommended Agile approach?
- Accept the duration as necessary
- Remove unit tests to speed up the build
- Parallelize tests and optimize the pipeline to keep builds under 10 minutes (Correct answer)
- Run CI only on release branches
Correct answer: Parallelize tests and optimize the pipeline to keep builds under 10 minutes
Fast feedback is essential to CI; pipelines exceeding ~10 minutes discourage frequent commits and slow the feedback loop.
Question 5: What is the purpose of a 'staging' environment in a CI/CD pipeline?
- To store backups of production data
- To provide a production-like environment for final validation before release (Correct answer)
- To run unit tests in isolation
- To host developer workstations
Correct answer: To provide a production-like environment for final validation before release
Staging mirrors production to catch integration, configuration, and environment-specific issues before deployment.
Question 6: Which practice helps prevent merge conflicts from accumulating in a CI workflow?
- Using long-lived feature branches
- Integrating code to the mainline at least once per day (Correct answer)
- Locking the main branch during sprints
- Assigning a dedicated merge manager
Correct answer: Integrating code to the mainline at least once per day
Frequent integration to the mainline minimizes divergence and reduces the size and complexity of merge conflicts.
Question 7: In CI, what is the role of a 'build script'?
- A document describing the release plan
- An automated script that compiles, tests, and packages the application consistently (Correct answer)
- A manual checklist for QA engineers
- A configuration file for the version control system
Correct answer: An automated script that compiles, tests, and packages the application consistently
A build script automates the entire build process so it runs identically on any machine, removing 'works on my machine' problems.
In CI, what does a 'broken build' notification ideally trigger first?