API tests

Why hundreds of UI tests cannot replace good API tests

A team often begins automation where it can see the application: in the browser. As the number of end-to-end tests grows, however, so do execution time, maintenance and intermittent failures. The suite then fails to provide feedback as quickly as the team needs before a release.

What is the problem?

Testing through the interface is generally one of the slowest and most demanding ways to verify business logic.

It is slower. Each test must start a browser, load the page, wait for it to render and move through several screens. A direct API test omits these steps, so it is usually significantly faster for the same check.

It has more reasons to fail. A test through the interface depends on the HTML structure, animations, the cookie banner and loading timing. If results are often false negatives, the team gradually stops trusting them.

It provides less information about the cause. When a UI test fails during an order, it shows that the purchase journey does not work, but diagnosis must pass through several layers. An API test can identify more precisely the endpoint, input and response at which the problem occurred.

It cannot cover every input. Through the interface, it is difficult to check whether an endpoint exposes another customer’s order, what the server does with a negative quantity or what the response looks like when permission is missing. The form will not normally submit such a request, but the server must still process or reject it correctly.

How we address it

We move the centre of gravity of testing below the UI layer. We verify business logic—calculation accuracy, error states, authorisation matrices, boundary values and negative scenarios—directly through the API, where it can be triggered reliably and quickly.

Browser-based testing does not disappear. It has a different role: verifying that the interface and individual layers work together, for example that a customer can complete login, a purchase or a payment. We choose the number of such scenarios according to risk; there is no fixed rule or prescribed number of tests.

Quick API checks can run with every change, while slower end-to-end scenarios can be run according to risk. The team receives earlier feedback without losing checks of critical customer journeys.

If you already use Playwright for web testing, we can write API tests directly in it. They run in the same configuration and report to the same place, so the team does not have to monitor two systems. Python with pytest or Bruno can work equally well; we choose the tool according to your technology stack, not our personal preference.

What you gain

You receive faster feedback, more stable results and a defect found closer to its source. The team sets the execution frequency according to the length of the suite and the importance of each check.

Maintenance may also decrease. If a redesign does not change the API contract, tests at the API layer generally do not need to be modified, whereas tests tied to page elements will be affected by the change.

If you already have an extensive UI suite, we do not discard it. We review which parts make sense to move to a lower layer and retain the scenarios that genuinely need to be verified through a browser.

Next step

If your suite takes too long, list the slowest scenarios and identify the logic that can be checked without a browser. You can review the proposed division in a no-obligation consultation; more information is also available on the API tests page.

Related topics

You might also be interested in

You can detect errors in the business logic more quickly directly through the API

Functional, integration and contract testing of REST, SOAP or GraphQL interfaces with the possibility of connection to the CI/CD pipeline.