|

8 Types of API Tests Mapped to the Right Architecture Layer: Where Each Lives and Why

Most SDETs can name 8 types of API tests. But ask them where in the architecture each lives and why — blank stares. This mapping is what separates candidates who understand systems from those who memorize lists.

Contents

The Architecture Map

Test TypeArchitecture LayerWhen to RunWhat It Catches
SmokeAPI Gateway / Load BalancerEvery deploymentIs the system alive?
FunctionalIndividual MicroserviceEvery PRBusiness rules, state changes, DB writes
IntegrationService-to-Service boundaryEvery PRPOST-GET-UPDATE contract validation
LoadGateway + All ServicesNightly/WeeklyBehavior under expected traffic
StressFull StackBefore releaseBreaking point and recovery
SecurityGateway + Every EndpointEvery meaningful changeOWASP Top 10 vulnerabilities
FuzzEvery Service EndpointWeeklyCrashes from malformed input
RegressionFull Service LayerEvery PR + NightlyYesterday’s behavior still holds

1. Smoke Tests: The Heartbeat

Lives at the load balancer and API gateway. Answers one question: is the system accepting requests? Run on every deployment before anything else touches the pipeline.

test('API smoke check', async ({ request }) => {
  const health = await request.get('/api/health');
  expect(health.ok()).toBeTruthy();
  
  const auth = await request.get('/api/auth/status');
  expect(auth.status()).toBe(200);
  
  const db = await request.get('/api/health/db');
  expect(db.ok()).toBeTruthy();
});

2. Functional Tests: Business Logic

Lives inside individual microservices. Validates that business rules execute correctly — state changes happen, DB writes persist, downstream events fire.

3. Integration Tests: The Handshakes

Lives at service-to-service boundaries. Validates the POST-GET-UPDATE contract: if I create something via Service A, can Service B read it correctly?

How to Audit Your Test Suite

Map your existing tests against this table. Which of the 8 types are missing? Most teams have functional and regression covered but completely skip security and fuzz testing.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.