Tests must run automatically on every change.
Pipeline stages:
- PR validation: scratch org, deploy, run tests, delete. Fast feedback.
- Pre-deploy: validate-only deploy with full tests.
- Post-deploy: smoke tests confirm working.
Quality gates:
- Apex coverage 75%+.
- Test pass rate 100%.
- PMD findings under threshold.
Tools: GitHub Actions, GitLab CI, DevOps Center, Gearset, Copado.
Test types in CI:
- Apex unit tests (always).
- Jest LWC tests (always).
- API tests (Postman/Newman).
- UI tests (selectively; slow).
- Performance tests (periodically; not on every commit).
Common pitfalls:
- Slow pipeline — devs bypass.
- Flaky tests — CI unreliable.
- No quality gates — broken code reaches prod.
Senior insight: CI is QA infrastructure. Investment pays back over years.
