DEV Community

Cover image for The Messy Middle Is Where Tests Earn Their Keep
David Frei
David Frei

Posted on

The Messy Middle Is Where Tests Earn Their Keep

Most product demos follow the same shape.

The user starts in a clean state, enters valid information, clicks the obvious button, and reaches the expected result.

Most real failures happen somewhere else.

They happen after the session expires.

They happen when a role changes but the page still holds cached permissions.

They happen when a filter, sort order, and pagination state interact.

They happen when an LLM returns valid JSON with the wrong business meaning.

They happen when a discount succeeds but shipping recalculation fails.

This is the messy middle: the states between a pristine happy path and a cleanly handled error.

It is also where browser automation earns its keep.

Admin consoles are state machines wearing tables

AI products often begin with a chat interface and quickly accumulate an admin console.

Someone needs to manage:

  • users;
  • roles;
  • prompts;
  • models;
  • usage limits;
  • audit history;
  • data retention;
  • feature access;
  • approval policies.

These screens look like ordinary forms and tables, but they contain dense permission logic. A Viewer may see settings but not edit them. An Editor may change prompts but not billing. An Admin may revoke access but not erase audit history.

A practical look at Endtest for AI admin consoles, audit trails, and role-based settings points toward a test strategy based on transitions, not pages.

Do not merely verify that the settings page loads.

Verify what changes when:

  • a user’s role is downgraded mid-session;
  • an action is attempted in two tabs;
  • a setting is edited by two administrators;
  • an audit event is written;
  • a restricted control is hidden versus disabled;
  • permissions are refreshed after reauthentication.

The expensive defect is rarely “the page failed to render.”

It is “the page rendered a stale version of authority.”

Privacy changes create cross-browser business logic

Third-party cookie restrictions are often discussed as a browser compatibility issue.

For many products, they are an authentication and attribution issue.

Embedded login, payment providers, support widgets, analytics, and cross-domain handoffs may behave differently across Chrome, Edge, and Safari. The main page can appear healthy while a critical integration silently loses state.

The useful work in reproducing third-party cookie breakage across Chrome, Edge, and Safari is not simply toggling a browser setting.

It is reproducing the user journey that depends on the cookie:

  1. begin on one domain;
  2. move through an embedded or redirected service;
  3. return with the expected state;
  4. recover when state is unavailable.

A test should verify both success and graceful degradation.

Users do not care that a cookie was blocked.

They care that login restarted, payment lost their cart, or support chat forgot the conversation.

Search interfaces fail through combinations

Search, filter, and sort pages are easy to test badly.

A generated suite may check each control independently:

  • search returns results;
  • category filter works;
  • sort order changes;
  • pagination advances.

The real defects appear when state combines:

  • sorting resets the selected filters;
  • changing the query preserves an invalid page number;
  • clearing one filter clears all of them;
  • the URL and visible controls disagree;
  • back navigation restores only part of the state;
  • results update but the count does not.

This is why evaluating test automation platforms for search, filter, and sort workflows without selector noise should focus on state modelling.

Selectors matter, but they are not the primary difficulty.

The difficult part is expressing and reusing combinations without creating hundreds of nearly identical tests.

A good approach defines a small set of representative states:

  • no filters;
  • one filter;
  • conflicting filters;
  • empty results;
  • deep-linked state;
  • restored browser history;
  • changed data between requests.

Then assert the relationship between controls, URL state, results, and counts.

Valid JSON can still be wrong

LLM features add a new category of false confidence.

A model returns JSON. The parser accepts it. The schema validator passes it. The test turns green.

But the output can still violate the product’s actual rules.

Imagine an expense-classification service returning:

{
  "category": "travel",
  "amount": -240,
  "currency": "EUR"
}
Enter fullscreen mode Exit fullscreen mode

The object may satisfy a basic schema while being nonsensical for the workflow.

The techniques for testing LLM structured outputs against JSON Schema, regex rules, and golden files work best as layers:

  1. Syntax: Is the output parseable?
  2. Shape: Does it match the schema?
  3. Constraints: Do values satisfy domain rules?
  4. Relationships: Are fields consistent with one another?
  5. Semantics: Is the result acceptable for the user’s task?
  6. Stability: Does the output remain within an acceptable range across repeated runs?

Golden files can help, but exact matching is often too strict for probabilistic output.

The test should define an acceptable envelope, not demand one sacred sentence.

Authentication should be tested after it stops being convenient

A login test that starts logged out, enters valid credentials, and reaches the dashboard is necessary.

It is also the least interesting authentication scenario.

Production failures happen when:

  • SSO returns to the wrong tenant;
  • MFA expires;
  • the browser opens a second tab;
  • the session expires during a form;
  • refresh tokens are rejected;
  • reauthentication succeeds but local state is stale;
  • logout clears one system but not another.

A useful evaluation of SSO, MFA, and expiring-session recovery with Endtest should ask whether the tool can preserve and observe the full sequence.

The assertion is not merely “the user logged in.”

It is:

  • the user returned to the intended action;
  • sensitive data was not exposed during the transition;
  • duplicate submissions did not occur;
  • the correct tenant and role were restored;
  • stale session data was cleared;
  • failure offered a recoverable path.

Session recovery is part of the product.

Treating it as test setup hides bugs.

Checkout failures are usually interaction failures

Checkout is often represented as a funnel:

cart → address → shipping → payment → confirmation.

Real checkout is a branching system.

Discounts change totals. Shipping rules depend on location, inventory, and basket value. Payment may require a redirect. Stock may change while the user is entering details. A failed attempt may be retried. A guest may log in midway through the flow.

The challenge in testing multi-step checkout flows without letting discounts, shipping rules, and recovery paths drift is choosing combinations that expose risk without creating an impossible test matrix.

One useful method is to identify state-changing boundaries:

  • promotion applied;
  • address validated;
  • shipping method selected;
  • tax recalculated;
  • payment authorized;
  • order committed.

Then test failures immediately before and after those boundaries.

Can the user retry?

Are totals still correct?

Was an order created twice?

Did the discount disappear?

Did the cart remain recoverable?

These questions produce much more confidence than checking that every field accepts input.

Model transitions, not screens

The common thread across admin consoles, cookie restrictions, filters, AI outputs, authentication, and checkout is state transition.

A screen is a snapshot.

A defect often lives in the handoff between snapshots.

That suggests a practical design rule:

Name tests after the state change and the business consequence.

Weak name:

checkout test 14

Better name:

preserves discount after payment retry

Weak name:

admin permissions

Better name:

revokes editor controls after role downgrade

Weak name:

search filters

Better name:

restores query and filters after back navigation

The better names force the team to articulate why the test exists.

They also make failures easier to route because the consequence is visible before anyone opens the logs.

The happy path is necessary, not sufficient

Happy-path tests are useful smoke detectors. They tell you whether the main road is open.

But product quality is often determined by what happens when the user takes a detour, loses state, retries an action, encounters stale permissions, or receives output that is technically valid but practically wrong.

That is the messy middle.

You do not need to test every combination.

You need to identify the transitions where money, trust, access, or user work can be lost.

Start there.

Those are the tests people remember being grateful for.

Top comments (0)