CI/CD and Testing
Continuous Integration and Continuous Delivery, commonly known as CI/CD, form the technical backbone for fast and secure software deployment. Testing is a central quality measure in CI/CD. A well-designed pipeline executes automated tests in the right sequence and ensures that only verified code reaches production.
In a Nutshell
- CI/CD automates building, testing, and deployment.
- Tests run in stages from fastest to slowest.
- Continuous Integration focuses on merging and testing code regularly.
- Continuous Delivery and Deployment enable frequent releases.
- A stable pipeline requires fast tests, clear stages, and reliable environments.
Technical Overview
CI/CD describes processes where code changes are automatically built, tested, and delivered. Continuous Integration means regular commits and automatic testing. Continuous Delivery prepares releases automatically but requires a manual approval step. Continuous Deployment releases software without human intervention.
Typical Pipeline Stages
- Checkout: Fetch source code.
- Build: Compile and install dependencies.
- Static Analysis: Linting and formatting checks.
- Unit Tests: Fast tests for isolated logic.
- Integration Tests: Verify component interactions.
- E2E Tests: Critical user workflows.
- Performance Tests: Runtime behavior analysis.
- Security Tests: Identify vulnerabilities.
- Deploy to Staging: Deploy to test environment.
- Deploy to Production: Release to live.
Deployment Strategies
- Blue-Green: Two parallel environments enable quick rollback.
- Canary: Gradual rollout to a small user segment.
- Feature Flags: Enable or disable features at runtime.
Practical Example
Pipeline:
1. Checkout
2. npm install
3. npm run lint
4. npm run test:unit
5. npm run test:integration
6. npm run build
7. npm run test:e2e
8. Deploy to staging
9. Manual approval
10. Deploy to production
Advantages and Disadvantages
Advantages
- Rapid feedback after each commit.
- Frequent, low-risk releases.
- Reproducible builds.
- Fewer manual errors.
- Higher software quality.
Disadvantages
- Initial setup overhead.
- Complexity with environments and secrets.
- Pipeline flakiness from unstable tests.
- Security requirements for credentials.
Key Exam Topics
- Difference between CI, Continuous Delivery, and Continuous Deployment.
- Typical pipeline stages.
- Deployment strategies.
- Importance of test automation.
- Benefits and risks.
Common Exam Questions (with Brief Answers)
-
What does CI/CD mean? Automated processes for building, testing, and delivering software.
-
Why do Unit Tests run first? They’re fast and provide immediate feedback.
-
What is a Canary Release? Gradual rollout to a small user segment.
-
What is a Feature Flag? A runtime switch to toggle features on or off.
-
What’s an advantage of Blue-Green Deployment? Quick rollback if problems arise.
Key Resources
- https://martinfowler.com/articles/continuousIntegration.html
- https://www.atlassian.com/continuous-delivery
- https://en.wikipedia.org/wiki/CI/CD
Frequently Asked Questions
What is CI/CD?
Automated processes for building, testing, and delivering software.
What’s the difference between Delivery and Deployment?
Delivery prepares a release; Deployment executes it automatically.
Which tests run first?
Static analysis, linting, and unit tests.
What is a Canary Release?
Gradual rollout to a small user base.
What is Blue-Green Deployment?
Two parallel environments for quick rollback.
What is a Feature Flag?
A runtime switch to control feature availability.
How do you protect secrets?
Store them encrypted and inject via environment variables.
What is a Nightly Build?
An automated build that runs at night with more comprehensive tests.
What is a Quality Gate?
A quality condition that must pass before proceeding to the next stage.
Why are flaky tests problematic?
Unpredictable failures erode confidence in the pipeline.
What is a Rolling Deployment?
Instances are updated gradually rather than all at once.
What is a Build Artifact?
The output produced by a build process.
What role does testing play in DevOps?
A central role in providing rapid feedback and enabling frequent deployments.
What is a Staging Environment?
A pre-production environment that mirrors live conditions for realistic testing.
What is a manual approval step?
Explicit authorization required before releasing to production.
Next in the Software Testing Learning Path
The next article in the Software Testing Learning Path covers Regression Testing — how regression tests ensure that new changes don’t break existing functionality.



