WritingTesting Gates in CI/CD Pipelines: What to Automate and Where to Draw the Line — LinkIT
5 min readtesting-gates, ci-cd, test-automation, quality

Testing Gates in CI/CD Pipelines: What to Automate and Where to Draw the Line

Learn how to design effective testing gates in CI/CD pipelines — which tests to automate, how to set coverage thresholds, and when manual gates still make sense.

A testing gate prevents a change from advancing until defined checks pass. Choose gates based on the failures you need to detect, the time each check takes, and the decisions that require a person.

What Testing Gates in CI/CD Pipelines Are

A gate is a condition that must pass before the pipeline proceeds. Gates are implemented as pipeline jobs that must return a success exit code. If a gate fails, the pipeline stops — the merge is blocked, the deploy does not happen, the artifact is not promoted.

The power of gates is also their risk: a poorly calibrated gate that fails too often for the wrong reasons teaches the team to work around it. Gates require ongoing calibration to stay useful.

The Four Gate Types Every Production Pipeline Needs

Gate 1: Static Analysis and Type Checking

What it is: linting, type checking, and code style validation. These run in seconds and catch a meaningful percentage of errors before any test runs.

How strict: Fail on any error. No warnings are acceptable in a gate — warnings that do not block become noise that the team learns to ignore.

Where in the pipeline: First. This gate should fail in under 60 seconds so developers get immediate feedback without waiting for a full test run.

Gate 2: Unit and Integration Tests with Coverage Threshold

What it is: automated tests that verify application logic in isolation (unit tests) and against real service dependencies (integration tests).

How strict: Assess current coverage and the untested paths that matter. Set a threshold that supports useful tests, then raise it as coverage improves rather than choosing a universal percentage.

The coverage threshold is less important than which code is covered. Critical business logic — payment processing, authentication, data validation — should have near-complete coverage regardless of the overall threshold.

Where in the pipeline: After static analysis, before build.

Gate 3: Dependency Security Scan

What it is: automated scanning of your dependency tree for known CVEs and security vulnerabilities. Tools like Snyk, npm audit, or Trivy handle this.

How strict: Block on critical and high severity findings. Do not block on medium or low — the signal-to-noise ratio is too low, and blocking on medium findings means blocking on issues that have no realistic exploit path in your context.

Where in the pipeline: Parallel with unit tests. This gate should not add to the critical path.

Gate 4: Post-Deploy Smoke Tests

What it is: a short suite of HTTP checks and synthetic transactions that run against the newly deployed environment to confirm the application is actually serving traffic correctly.

How strict: Any failure triggers automatic rollback. A smoke test that passes despite a broken deploy is worse than no smoke test — it gives false confidence.

Where in the pipeline: Immediately after each deployment stage (staging and production).

The Coverage Threshold Calibration Problem

Coverage measures execution, not test quality. Review whether important behavior and failure paths are asserted before relying on a percentage threshold.

The better approach is to use path-based coverage requirements:

  • Set a reasonable minimum for overall coverage (70-75% for most codebases)
  • Set a higher minimum for specific directories that contain business-critical code
  • Fail if new code introduced in a PR has coverage below a threshold (differential coverage)

Differential coverage gates are more useful than absolute coverage gates for growing codebases — they ensure new code is tested without requiring developers to retrofit tests for old code all at once.

Where Manual Gates Still Belong

Not every gate should be automated. Some checkpoints require human judgment.

Production approval gates: For high-stakes releases, a required reviewer must explicitly approve before the pipeline continues to production. This is not a quality check — it is an organizational control. Many teams require this around major releases, peak traffic periods, or after significant architecture changes.

Release manager sign-off: In regulated industries, certain deployments require documented approval from a named individual. This cannot be automated away and should not be.

QA exploratory testing: Automated tests verify known behaviors. Exploratory testing catches the unknown unknowns — edge cases that no test anticipated. Reserve time for it in the release cycle. It does not belong in the automated pipeline, but it belongs in the process.

Gates That Often Create More Problems Than They Solve

E2E test suites as mandatory gates on every PR. End-to-end tests are inherently slower and flakier than unit or integration tests. Using them as a hard gate on every pull request creates bottlenecks. A better pattern: run E2E tests as a non-blocking check on PRs and a blocking check on the staging deploy.

Performance tests as PR gates. Performance tests require production-equivalent data volume to be meaningful. Running them on every PR with synthetic data produces misleading results and wastes pipeline time.

Manual approval on every staging deploy. Staging is for catching integration issues before production. Adding a manual approval to the staging deploy creates a human bottleneck on an environment that should be rapidly iterating. Reserve manual gates for production.


Review gate failures and runtime regularly. Keep checks that catch relevant problems and address flaky tests that make results difficult to trust.

Discuss CI/CD testing gates with LinkIT