← Back to list

Most API Tests Are Missing Real Bugs — Fix it with Scalable Playwright Framework

A practical guide to building scalable API test automation with business-level validation using Playwright

Fadhila Rizki Anindita · 2026-04-26 11:52 · 0 claps · 2.0 min read
#playwrights #api-test-automation #ajv #schema-validation #qa-engineer
Open on Medium ↗

Most API Tests Miss Real Bugs — Fix it with Scalable Playwright Framework

As API-driven systems grow, maintaining reliable and scalable test automation becomes increasingly challenging. Simple API tests that validate status codes or response schemas are no longer sufficient to catch real-world issues, especially when business logic such as pricing, discounts, and data aggregation is involved.

In this article, we will explore how to design a scalable API test automation framework using Playwright. Instead of focusing only on basic request validation, we will implement reusable request handlers, structured test data, and business-level assertions to validate scenarios dynamic total cart calculations.

By the end of this guide, you will have a clean, maintainable, and extensible API testing approach that goes beyond basic checks and aligns with real-world QA engineering practices.

Project Structure

To keep the test framework scalable and maintainable, we organize it as follows:

This structure separates:

  • API interaction (api-client)
  • business logic (services)
  • validation (utils)
  • test cases (tests)

This article only use 1 API : GET Cart By User ID, so we don’t use folder request-objects & file data-generator.ts. But, if you want test API POST & PUT use both of them.

Architecture Overview

The following diagram illustrates the overall architecture of the API test automation framework:

This layered design ensures that changes in one layer (e.g., API structure or business logic) do not directly impact test cases, making the framework more maintainable and scalable over time.

This layered design ensures that changes in one layer (e.g., API structure or business logic) do not directly impact test cases, making the framework more maintainable and scalable over time.

The framework is designed using a layered approach to ensure separation of concerns and scalability:

  • Test Layer: Defines test scenarios and orchestrates execution
  • Service Layer: Handles data preparation and abstraction of business flows
  • API Client Layer: Encapsulates API interactions per domain
  • Request Handler: Provides a reusable and configurable HTTP layer
  • Utils Layer: Contains reusable assertions, logging, and schema validation

Basic API validation is no longer enough for modern systems. To build reliable and scalable test automation, we need to validate not only responses, but also the business logic behind them.

By combining:

  • structured architecture
  • reusable request handling
  • and business-level assertions

We can create tests that are not only maintainable, but also capable of catching real-world issues.

This approach moves API testing from simple verification to meaningful validation — aligning test automation with real QA engineering practices.

Repo : https://github.com/fadhilara/api-playwright


메타데이터
post_id
4532e090cbd4
slug
your-api-tests-are-missing-bugs-heres-how-to-fix-them-with-playwright-4532e090cbd4
url
https://medium.com/@fadhilara/your-api-tests-are-missing-bugs-heres-how-to-fix-them-with-playwright-4532e090cbd4
canonical_url
https://medium.com/@fadhilara/your-api-tests-are-missing-bugs-heres-how-to-fix-them-with-playwright-4532e090cbd4
author_url
https://medium.com/@fadhilara
status
ok
fetched_at
2026-07-11 00:19:17