CI/CD and Testing
Continuous Integration and Continuous Delivery, commonly abbreviated as CI/CD, form the technical backbone for fast and safe software deployment. Testing plays a central role in CI/CD as a quality assurance mechanism. A well-designed pipeline runs automated tests in the correct sequence, ensuring that only validated 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 frequently.
- Continuous Delivery and Deployment enable frequent releases.
- A stable pipeline requires fast tests, clear stages, and reliable environments.
Core Concepts
CI/CD describes processes where code changes are automatically built, tested, and delivered. Continuous Integration means developers check in code regularly and tests run automatically. Continuous Delivery prepares releases automatically but requires a manual approval step before going live. Continuous Deployment releases code without human intervention.
Typical Pipeline Stages
- Checkout: Fetch source code.
- Build: Compile and install dependencies.
- Static Analysis: Run linting and formatting checks.
- Unit Tests: Fast tests for isolated logic.
- Integration Tests: Verify component interactions.
- E2E Tests: Test critical user workflows.
- Performance Tests: Check runtime behavior.
- Security Tests: Identify vulnerabilities.
- Deploy to Staging: Push to test environment.
- Deploy to Production: Release to users.
Deployment Strategies
- Blue-Green: Two parallel environments enable quick rollback.
- Canary: Gradual rollout to a small user segment.
- Feature Flags: Toggle features on or off 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
- Fast feedback after every commit.
- Frequent, low-risk releases.
- Reproducible builds.
- Fewer manual errors.
- Higher software quality.
Disadvantages
- Initial setup effort.
- Complexity managing environments and secrets.
- Pipeline unreliability from flaky 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 Short Answers)
-
What does CI/CD mean? Automated processes to build, test, and deliver software.
-
Why do unit tests run first? They’re fast and provide immediate feedback.
-
What is a canary release? Gradual rollout to a small portion of users.
-
What is a feature flag? A runtime switch to enable or disable features.
-
What’s an advantage of blue-green deployment? Quick rollback if issues 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 to build, test, and deliver software.
What’s the difference between Delivery and Deployment?
Delivery prepares releases, Deployment runs automatically.
Which tests run first?
Static analysis, linting, and unit tests.
What is a canary release?
Gradual rollout to a small number of users.
What is blue-green deployment?
Two parallel environments for quick rollback.
What is a feature flag?
A runtime switch for toggling features.
How do you protect secrets?
Store them encrypted and inject via environment variables.
What is a nightly build?
A build that runs overnight with comprehensive tests.
What is a quality gate?
A quality criterion that must pass before proceeding.
Why are flaky tests problematic?
Unpredictable failures undermine confidence in the pipeline.
What is a rolling deployment?
Instances are updated gradually, one at a time.
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.
What is a staging environment?
A pre-production environment for realistic testing.
What is a manual release gate?
Explicit approval required before releasing to production.
Next in the Software Testing Learning Path
The next article in the Software Testing learning path covers regression tests — how regression tests ensure that new changes don’t break existing functionality.



