Drizz raises $2.7M in seed funding •
Featured on Forbes
Drizz raises $2.7M in seed funding •
Featured on Forbes
Logo
Schedule a demo
Blog page
>
Test Optimization: Cut Suite Runtime without Losing Coverage

Test Optimization: Cut Suite Runtime without Losing Coverage

Test optimization playbook. The right order of operations, mobile-specific tactics, and the maintenance discipline that stops suites from re-growing.
Author:
Asad Abrar
Posted on:
June 30, 2026
Read time:

Key takeaways

  • Test optimization is a sequencing problem, not a strategy list. Most teams parallelize before stabilizing, deduplicate before measuring, and chase AI features before fixing basics. Order matters.
  • The hardest part isn't cutting suite. It's keeping it cut. Without maintenance discipline, a suite trimmed by 40% grows back in two quarters.
  • For mobile teams, limiting factor is rarely test code. It's build install time, real-device queue depth, and per-device flakiness. Web optimization advice doesn't translate.

Test optimization is systematic process of cutting test suite runtime and maintenance overhead without losing bug-catching power that justifies suite existing.

Generic posts on this topic give you a list: prioritize, parallelize, deduplicate, add AI. That list isn't wrong, it's unordered. Apply those tactics in wrong sequence and you'll burn three months building infrastructure on top of a foundation that doesn't hold.

What test optimization is, and isn't

Definition: test optimization is practice of reducing test suite runtime, cost, and maintenance burden while maintaining or improving defect detection.

The two halves matter equally. A suite that runs in 3 minutes but misses regressions isn't optimized, it's broken. A suite that catches every bug but takes 4 hours per CI run isn't optimized either, because nobody waits for it.

Optimization is not:

  • Cutting tests because they're slow
  • Adding parallelism to a flaky suite
  • Replacing manual testing with automation without auditing what got dropped
  • Buying an AI tool and hoping metrics improve

Optimization is:

  • Measuring what each test catches and what it costs
  • Cutting tests that catch nothing new
  • Speeding up tests that catch something but run slow
  • Making suite easier to maintain so it stays optimized

The first two require data. The second two require infrastructure. Most teams skip to infrastructure and wonder why savings evaporate.

The right order of operations

Six steps, in this order. Skipping any of them undermines next.

Step 1: Inventory

Before optimizing anything, you need data on what's in suite. For each test:

  • Average runtime
  • Pass rate over last 30 days
  • Last time it caught a real bug (not a flake)
  • Code modules it covers
  • Who owns it

This usually surfaces shock data. A typical 1,000-test mobile suite includes 200 tests that haven't failed in 6 months, 80 that have failed every week for a year (all flakes), and 50 that take 5x longer than average.

You can't make optimization decisions without this inventory. Cutting "slow tests" without knowing which ones catch real bugs is how teams lose regression coverage in name of speed.

Step 2: Stabilize

Fixing flakes is a prerequisite for any real test optimization effort. Parallelizing a flaky suite multiplies flakiness instead of cutting runtime, because failures trigger reruns, which trigger more failures.

The math: a suite with 90% pass rate per test and 200 tests has a 0.9^200 = ~7×10⁻¹⁰ chance of a clean run. In practice, you'll never see green. Add parallelism and you'll see more flakiness, not less.

Fix flakes first. Quarantine worst offenders. Get suite to 97%+ pass rate before you touch anything else.

Step 3: Cut redundancy

With inventory in hand, find tests that catch nothing rest of suite doesn't.

Three types of redundancy to look for:

  • Duplicate assertions. Two tests that validate same behavior through different paths.
  • Dead coverage. Tests for features that got deprecated or removed.
  • Over-tested happy paths. Six tests on login because nobody pruned older ones when new ones were added.

The cut isn't arbitrary. Use mutation testing or coverage analysis to verify that removing a test doesn't reduce bug-detection. Tools like PIT (Java) or Stryker (JS/TS) introduce small code changes and check whether tests catch them. Tests that catch zero mutations are candidates for deletion.

Cut conservatively, but cut. A leaner suite is easier to maintain, faster to run, and clearer in its purpose.

Step 4: Prioritize and sequence

Not every test runs every time. Categorize suite into tiers:

  • Smoke (20-50 tests): The minimum to ship. Login, core navigation, payment. Runs on every PR.
  • Impacted subset: Tests covering modules touched by diff. Test Impact Analysis or feature-tagged TIA. Runs on every PR.
  • Full regression: Everything that's still in suite. Runs post-merge or nightly.
  • Cross-platform matrix: Full suite × device combinations. Runs pre-release or weekly.

Each tier has a different time budget. Smoke must finish in 5 minutes. Impacted subset in 15. Full regression in 60. Cross-platform whenever, as long as it finishes before release decision.

The point of tiering isn't gatekeeping. It's matching test cost to feedback urgency.

Step 5: Parallelize

Now you can parallelize without making things worse. Tests are stable, redundant ones are gone, tiers are sequenced. Parallelism multiplies savings from steps 1-4 instead of compounding existing problems.

Parallel execution is fastest path to meaningful test optimization, but only after suite is in shape to handle it. A 200-test stable suite with proper isolation runs in parallel across 20 workers in 5 minutes instead of 90.

Strategies that compound:

  • Time-based sharding instead of file-based
  • App install caching across tests
  • Per-test fixtures, no shared singletons
  • Critical path tests run first in each shard

Step 6: Maintain

This is step nobody writes about. A suite trimmed from 1,000 to 600 tests grows back to 1,000 in 6 months if there's no discipline around what gets added.

Cutting maintenance is one half of test optimization; cutting runtime is other. They're related but not identical. A test that runs in 200ms but breaks every UI change adds more maintenance cost than runtime cost.

Maintenance rules that work:

  • Every new test must declare what it catches that existing tests don't
  • Quarterly suite audit removes tests not run / not failed in 90 days
  • Flake budget: any test failing more than 5% gets quarantined within a week
  • Owner per test, surfaced in CI failure message

Without these, optimization is a one-time event, not a practice.

The metrics that decide what to optimize next

Don't optimize on instinct. Track these four numbers per suite:

Metric Target What it tells you
Suite pass rate >97% Stability. Below this, parallelism makes things worse
Mean test runtime <30s for E2E Suite speed ceiling
Defect detection rate Trending up Whether cuts removed useful tests
Maintenance cost (engineer hours/week) <10% of QA capacity Whether maintenance is sustainable

Pass rate decides whether to stabilize or parallelize next. Mean runtime decides whether to shard or optimize individual tests. Detection rate decides whether you cut too much. Maintenance cost decides whether suite design is sustainable.

According to 2024 DORA State of DevOps report, elite-performing teams keep change failure rates under 5% and recover from incidents in under an hour. Both of those depend on a test suite that runs fast enough to give pre-merge feedback and reliably enough to be trusted.

Mobile specific test optimization

Web optimization advice translates partially to mobile. The mobile-specific concerns:

Build install time. A 30-second test takes 90 seconds on first run because app installs first. Across a 200-test suite with no install caching, you've burned 12 minutes on installs alone. App install reuse across tests is single biggest mobile-specific win. Most cloud device platforms support this, but it must be configured explicitly.

Real-device queue depth. A 20-device farm runs 20 tests in parallel. If suite has 500 tests at 1 minute each, that's 25 minutes minimum, plus queue time when multiple PRs land. Optimization here is matching device pool size to peak PR volume, not just average.

OS version matrix combinatorics. A test that runs on iOS 15, 16, 17, 18 and Android 11, 12, 13, 14 = 8 environments per test. Across 200 tests, that's 1,600 test executions. Use risk-based device selection: critical flows on full matrix, secondary flows on latest-version only.

Cold start vs warm start tests. A test that runs first hits a cold app. The same test running 50th hits a warm app with cached state. Different code paths, different timing, different results. Optimize by explicitly choosing cold or warm start per test instead of letting it depend on shard order.

Per-device flakiness aggregation. A test that's 99% stable on Pixel and 70% stable on Galaxy A52 shows up as "85% stable" in aggregate. The aggregate hides where to optimize. Track per-device pass rates.

What doesn't move needle as much as people think

Some commonly-recommended optimization tactics are oversold.

AI test generation. Generating tests faster doesn't help if you're already drowning in tests. The bottleneck is rarely test authoring speed, it's test maintenance and runtime. Generating 500 more tests makes both worse.

Self-healing locators. Useful, but bigger win is using a framework that doesn't depend on locators at all. Self-healing patches symptom (brittle selectors). Vision-based testing removes cause.

Massively parallel execution beyond a point. Past 30 to 50 parallel workers, marginal speed-up flattens because of orchestration overhead, device pool contention, and serialized setup costs.

More devices in matrix. Each added device class adds cost without proportionally adding coverage if your user base is concentrated on a few models. Pull analytics on actual device usage and prioritize top 80% of installs.

Faster machines. A faster runner cuts wall-clock time linearly. Sharding cuts it logarithmically. Sharding wins for any suite over ~100 tests.

Test optimization in continuous testing pipelines

Continuous testing means tests run constantly, on every commit, in background. It only works if tests are optimized. Otherwise, "continuous testing" becomes "continuous waiting."

A continuous testing pipeline that holds up has these properties:

  • Smoke tests finish in under 5 minutes per PR
  • Impacted tests finish in under 15 minutes per PR
  • Full regression in under 60 minutes post-merge
  • Cross-platform overnight, in under 6 hours
  • Failed tests automatically retry once, then alert
  • Test artifacts (logs, screenshots, video) attached to every failure

The numbers above assume an optimized suite. On an unoptimized suite, "continuous testing" turns into a flaky 4-hour CI run that engineers learn to ignore.

Google's Engineering Productivity Research has published on diminishing returns of test investment past a certain point. Their finding: each additional minute of test runtime past 15 minutes per PR reduces developer commit frequency more than it improves quality. The point isn't to test less, it's to test smarter.

A pragmatic 30-day plan

If you're starting from a 1,000-test mobile suite with 80-minute CI runs and 85% pass rate, here's sequence:

Week 1: Inventory and stabilize. Pull data on every test. Identify 50 worst flakes. Quarantine them. Don't try to fix them yet, just stop letting them block CI.

Week 2: Cut redundancy. Use coverage analysis to find tests that don't add unique value. Cut 10 to 20% of suite. Confirm detection rate stays flat.

Week 3: Tier and sequence. Define smoke, impacted, full regression tiers. Move smoke tier to every PR. Move full regression post-merge. CI per PR should now finish in under 20 minutes.

Week 4: Parallelize and shard. Time-based sharding within each tier. App install caching. Critical path tests first per shard. Target: full regression in under 30 minutes.

Ongoing: Maintain. Owner per test. Flake budget enforced weekly. Quarterly audit. New test policy that requires unique coverage justification.

A team running this sequence cleanly cuts CI time by 60 to 75% over 30 days without losing detection capability. The remaining gains come from infrastructure changes (better hardware, more devices, smarter test selection) and tooling shifts (vision-based testing for UI flake reduction).

Where test framework choice matters

For E2E mobile tests, framework decides whether test optimization is a one-time win or a permanent gain.

Selector-based frameworks (Appium, XCUITest, Espresso) tie tests to accessibility IDs, resource IDs, or XPath. Every UI refactor breaks tests. The maintenance cost grows linearly with codebase change velocity. Optimization gains erode as suite ages.

Vision-based frameworks find elements by what they look like, not by selectors. Drizz tests written as Tap "Add to cart" keep working when dev team renames resource ID or restyles button. The optimization gains compound instead of eroding, because suite doesn't accumulate maintenance debt with every UI change.

For high velocity mobile teams, this is difference between a suite that stays optimized and one that drifts back to broken within a release cycle. Optimization isn't just about runtime. It's about whether gains hold.

FAQ

What is test optimization?

The process of reducing test suite runtime and maintenance cost while keeping or improving defect detection. Cutting tests without losing coverage.

What's first step in optimizing a test suite?

Inventory and stabilization. Measure what each test catches and runs, then fix flakes. Cutting or parallelizing before this skips foundation.

Why does parallelization sometimes make things worse?

Parallel execution multiplies failure rate of flaky tests. A 90% stable test that runs 200 times in parallel is statistically certain to flake. Stabilize first.

How much can a typical mobile suite be optimized?

Most mobile suites can cut runtime 60 to 75% in 30 days through inventory, stabilization, redundancy removal, tiering, and parallelization, without losing detection.

What's difference between test optimization and test impact analysis?

TIA is one tactic inside test optimization. It picks which tests to run for a given change. Test optimization is broader practice including stabilization, cutting, tiering, and maintenance.

Does AI help with test optimization?

For UI maintenance (self healing locators, vision-based element matching), yes. For test generation, less than vendors claim. The bottleneck is usually maintenance and runtime, not authoring speed.

About the Author:

Asad Abrar
Co-founder & CEO, Drizz
Ex-Coinbase PM and IIT Kharagpur grad killing flaky mobile tests by day, and obsessing over F1 lap timings by night.
Schedule a demo