Back to stories
<QA/>

CI/CD and Test Automation: Running Tests in Pipelines

Share by

CI/CD and Test Automation: Running Tests in Pipelines

Automated tests add value when they run in CI/CD: every commit or push triggers tests, and failures block or warn before release. This post covers how to fit unit, API, and UI tests into pipelines and keep them fast and reliable.


Where tests run in the pipeline

  • On every commit/push: Unit tests (and often API smoke tests). Fast feedback in minutes.
  • On merge or nightly: Full API suite and UI smoke. Broader coverage.
  • Before release or deploy: Full regression (API + UI). Gate release on pass.

Adjust to your branch strategy (e.g. main vs feature branches) and how long full suite takes.


Fail the build (or block deploy)

  • Unit/API: Typically fail the build if tests fail; no deploy until fixed.
  • UI: Sometimes run as non-blocking first (flaky); fix flakiness, then make them block. Prefer stable tests so they can block.
  • Reporting: Publish test results (JUnit XML, etc.) so the team sees failures and trends.

Keeping pipelines fast and reliable

  • Parallelize: Run independent test jobs in parallel; split by layer (unit, API, UI) or by module.
  • Stable environment: Fixed browser/driver versions; clean state (DB, test data) per run.
  • Flakiness: Investigate and fix flaky tests; do not hide them with retries only. Use retries sparingly for known external issues.
  • Maintainability: Keep tests independent and fast so the pipeline stays usable.

Summary

  • Run unit (and API smoke) on every commit; full API and UI on merge or before release.
  • Fail the build (or block deploy) when critical tests fail; publish results for visibility.
  • Use parallel runs, stable environment, and fix flakiness to keep pipelines fast and trusted.