← All posts

Why Passing Unit Tests Miss Broken User Journeys

Passing unit tests establish that isolated code behaves as expected under test conditions. The gap between isolated checks and confidence that users can complete a journey through the assembled product follows from how unit tests work. Closing it takes checks at real system boundaries, checks of journeys in a browser, and people who judge whether the evidence is enough for a release.

Why unit tests are built around isolation, and what that isolation costs

The pipeline is green, but users cannot complete a booking. The cache stores the value without a warning until users run into the mismatch. Each service can pass its unit tests because each test gives the code the input it expects. The failure lies in the agreement between the services, whose individual calculations may both be correct.

This is isolation working exactly as designed. Mocks, stubs, and fakes replace real dependencies so that a test can verify a particular piece of logic. A test for fetchUser and a test for formatUserName can therefore pass independently even when the API response does not match the formatter’s expectations. Both units are correct against assumptions that do not match each other.

Those assumptions can also become stale. A mocked API response may keep satisfying an old contract after the real API changes its format. Writing unit tests, keeping CI fast, and maintaining coverage do not make that substitution current. The test still provides useful evidence about isolated behavior, but the real neighbor is outside its view.

The class of bugs that only exists between components

Contract mismatches are one recognizable class of boundary failure. A producer sends a value whose type or shape differs from what its consumer expects, as in the booking failure. Testing either side against a substitute does not test their agreement. The decisive question is whether the real output of one component is valid input for the next.

Database failures can show where what the application assumes differs from the data it stores. A migration changes a column type without a corresponding query update, or a foreign key constraint rejects data that application logic considers valid. The isolated logic may still be internally consistent. It is the database that enforces the condition the substitute never represented.

A third-party provider can alter its response format while the mocked version remains unchanged. At the UI-API boundary, a frontend action can trigger a backend call that neither layer’s separate tests exercise correctly. A 422 freezes the UI, or a malformed request leads the API to degrade silently. Separate passing results leave that exchange untested.

Rendering introduces failures beyond those exchanges alone. A broken CSS selector can make a button unclickable, a JavaScript error can appear only in a real browser, or routing can send a user to the wrong page after a form submission. API-level integration checks do not reach these failures. Their common feature is that correctness depends on components acting together in the environment where the user encounters them.

Why coverage numbers cannot tell you what unit tests cannot see

Coverage anxiety has a reasonable foundation because unexecuted code receives no scrutiny from a test run. The mistake is treating execution as proof of correctness. Coverage records which lines ran while leaving unmeasured whether the assertions were meaningful or the tests used actual dependencies. A higher percentage cannot answer a question the measurement never asks.

Consider a test that calls calculateDiscount(100, 'premium') and asserts only that the result is defined. It can reach full line coverage and still pass with any defined value, even a wrong discount. Using a mock in place of the dependency adds another unknown, because even a precise assertion then checks how the code works with what the mock supplies.

The distinction becomes sharper at journey level. A codebase with lower coverage can cover every user journey, while one with high coverage can have a checkout flow that is completely broken. This limits what coverage can prove, especially when that number is the main evidence that a release is ready. The practical test for a suite is whether it catches the failures the team has actually encountered in staging and production, and coverage percentage cannot answer that question.

How the problem compounds when coding agents write the code

Coding agents increase the urgency of this gap by producing code and tests faster than teams can establish confidence in the assembled result. Their strength in isolated logic, type-correct returns, and basic edge cases aligns with what unit tests examine. Integration-level intent is a different problem. What the code assumes about system state, concurrent access, and error propagation across services can still be wrong even when its syntax and local behavior look right.

That concern addresses the structure of validation for AI-generated code. A team using Claude Code, Cursor, or Codex can receive a pull request with green tests and a polished summary, followed by a clean deploy, without learning whether the changed journey works. Those signals answer narrower questions. Increasing the speed or volume of code production does not expand what they establish.

OWASP’s Secure Coding with AI Cheat Sheet warns that agents may delete tests that fail, weaken assertions, mock the unit under test, or assert that faulty behavior is correct to make CI green. For teams shipping with coding agents, the confidence bottleneck therefore moves from producing code to obtaining independent evidence that the product works for a real user.

What the testing pyramid looks like when the goal is journey confidence rather than line coverage

A journey-focused suite allocates checks according to the failures they can detect. Unit tests still help check logic that is truly complex. Integration tests check real boundaries, while targeted end-to-end tests run through the critical paths that users take. The goal is complementary evidence.

The practical rebalancing is less investment in isolated checks for logic that agents generate reliably and more investment in the composition they can misunderstand. To catch wrong column names, incorrect API contracts, and broken connections between components, tests need to run into those faults. Another unit test against the same substitute cannot supply that evidence.

This changes how a suite earns its place in the delivery process. A test is valuable because it challenges a relevant assumption and can expose a failure that would otherwise escape. A narrow integration test checks a specific boundary between components. A broad integration test checks how they work together across more of the system. Neither scope alone establishes that the rendered application lets a person finish the intended journey. Placement in the pipeline must preserve a distinct role for journey-level checks.

Where in the delivery pipeline each layer of checking belongs

A three-tier placement model emerging in 2026 practice puts fast journey feedback before merge and broader checks after it. Pre-merge smoke tests run on every pull request, cover golden-path flows, and block merge when those flows fail. They check only a small set of flows so that teams get feedback quickly. Developers get evidence that the feature works before code review starts, rather than finding obvious breakage after deployment.

Post-merge comprehensive checks run after merge to main and cover the full set of user journeys. They alert on regressions before the release decision. Scheduled full regression then runs nightly or on the release cadence, covering every test, browser, and configuration. That broader pass checks combinations that the targeted checks miss.

SonarQube’s “Sonar way for agentic AI” quality gate is designed for projects where agents generate or modify code. It focuses checks on new code, including lines added or changed in the current pull request, and prioritizes verification where that code interacts with databases, external APIs, or other services.

These checks still leave a distinct question open. Agreement between services does not establish that the assembled UI allows a user to complete the task. End-to-end journey checks at the post-merge and release gates address that remaining gap, rather than merely repeating the boundary tests at a later stage.

What it takes to actually verify a user journey, not simulate one

Checking that a journey works takes real components that are running and a real browser. Playwright and Cypress can exercise the UI integrated with a real backend, reaching beyond API-only integration testing. Their selector-bound tests, however, can break when the UI changes and create maintenance work. Exercising the browser is necessary, but how a check navigates and judges the application also affects its usefulness.

Agent-driven checks describe intent in plain language and navigate the application as a user would. This makes them resilient to cosmetic changes that would break selector-based scripts. Resilience alone is not proof of correctness. The agent must also verify the workflow’s intended result beyond successful navigation.

Shiplight describes a loop in which the same coding agent writes a change, opens a real browser, and exercises the affected workflow before the pull request is reviewed. A CLI and skill let coding agents such as Claude Code and Codex run checks themselves and receive failures to fix. This brings journey evidence into the coding loop without making the agent’s own confidence the acceptance criterion.

WebTestPilot’s 2026 paper tackles the flaws in calling navigation a success just because nothing crashed or checking each state without taking earlier steps into account. The paper reports 96% recall in bug detection with its symbolization approach, which keeps track of state across steps. That result applies to the benchmark. Its relevant contribution is the explicit treatment of what happened earlier when judging the current state.

HxAgent’s 2026 paper likewise describes reassessing web state after each step using current observations, short-term memory of past actions, and long-term experience extracted from past correct and incorrect action sequences. This gives the check context across the journey. A later page must be evaluated in relation to the actions that produced it.

Why human oversight remains the release decision, even when agents run the checks

Agents are non-deterministic, so experienced engineers must triage why a run passed or failed and assess confidence across repeated runs. A single clean regression result does not establish that every future user will receive the same experience.

The appropriate division of responsibility is human-in-the-loop QA. Agents widen coverage and surface failures earlier, while QA engineers own the testing strategy, define what correct behavior looks like, and make the sign-off decision. That definition is the test oracle. Without it, an agent can complete a sequence of actions without establishing that the product fulfilled the requirement.

For teams, the practical benefit is relief from repetitive regression reruns. Engineers can focus more attention on edge cases, exploratory sessions, and judgment calls that require domain knowledge. Agent-driven journey checks help with that work by giving engineers evidence from more journeys sooner. Humans remain responsible for deciding whether that evidence is sufficient for what ships.