Originally published on 2010-02-09; fully revised and updated.
Effective DevOps delivery depends on fast, reliable testing from the first commit to production release. This guide helps platform engineers, SREs, and application teams design a practical CI/CD testing strategy, map each test type to the right stage, and implement a maintainable pipeline.
What to test in a modern delivery pipeline
A balanced pipeline uses multiple test layers instead of relying on a single end-to-end suite. Each layer answers a different risk question.
- Lint and static checks: Catch syntax, style, and obvious quality issues quickly.
- Unit tests: Validate small code paths with fast feedback per commit.
- Integration tests: Verify service-to-service behavior and data interactions.
- End-to-end tests: Validate critical user journeys in a production-like flow.
- Smoke tests: Confirm core availability immediately after deployment.
Commit-to-production testing workflow
This workflow keeps early stages fast, then progressively increases confidence before promotion.
flowchart TD
A[Developer pushes commit] --> B[CI pipeline starts]
B --> C[Lint and unit tests]
C --> D{Checks pass}
D -- no --> E[Fail fast and notify]
D -- yes --> F[Build artifact]
F --> G[Integration tests]
G --> H[Security and policy checks]
H --> I{Release gate approved}
I -- no --> J[Stop and investigate]
I -- yes --> K[Deploy to staging]
K --> L[Smoke tests then promote]
Where each test type fits
| Test type | Best pipeline stage | Primary goal | Execution profile |
|---|---|---|---|
| Lint and static analysis | First CI stage | Fast quality guardrails | Very fast, runs on every change |
| Unit tests | Early CI stage | Logic correctness | Fast, high signal for regressions |
| Integration tests | Post-build CI stage | Dependency and API behavior | Medium runtime, environment-dependent |
| End-to-end tests | Staging or pre-release stage | Critical workflow validation | Slower, narrower scope recommended |
| Smoke tests | Immediately after deploy | Basic release health check | Fast, production-safety oriented |
Example CI pipeline configuration
The following example shows a simple staged approach in GitHub Actions: lint and unit tests first, integration checks next, then a deployment gate.
name: ci
on:
push:
branches: [ main ]
pull_request:
jobs:
lint_unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install -r requirements.txt
- run: flake8 .
- run: pytest -q
integration:
runs-on: ubuntu-latest
needs: lint_unit
steps:
- uses: actions/checkout@v4
- run: docker compose up -d
- run: pytest -m integration
- run: docker compose down -v
release_gate:
runs-on: ubuntu-latest
needs: integration
if: github.ref == 'refs/heads/main'
steps:
- run: echo "Ready for staging deployment"Code language: PHP (php)
Example local commands for CI parity
Developers should be able to run the same core checks locally to reduce CI failures and shorten feedback loops.
pip install -r requirements.txt
flake8 .
pytest -q
docker compose up -d
pytest -m integration
docker compose down -vCode language: CSS (css)
Common pitfalls and best practices
- Keep early stages fast: Slow first-stage pipelines reduce developer throughput.
- Fail early, fail clearly: Surface actionable logs and notifications at the first failing gate.
- Avoid overloading end-to-end suites: Reserve them for critical journeys, not all coverage.
- Use environment parity: Keep local, CI, and staging behavior as consistent as practical.
- Gate promotion intentionally: Require explicit checks before production rollout.
A strong CI/CD testing strategy is less about one tool and more about stage design, feedback speed, and risk-based gates. Start simple, measure failures by stage, and continuously refine.
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals