TechdomeVenture Studio
All Insights/Engineering Practice

API testing explained: types, what to automate, and tools

API testing checks an interface directly, below the UI. Learn the five main types, how mocking and test data fit in, and which tests to automate first.

Techdome Engineering
Techdome EngineeringEngineering Team
Oct 15, 20268 min read
Verified Architecture
API testing explained: types, what to automate, and tools

API testing means sending requests straight to an application's interface and checking the responses, without going through the user interface. It is faster and more stable than browser testing and it catches most logic bugs before a screen ever shows them. Start by automating the functional checks on your most important endpoints, then add contract, integration, load and security tests as the product grows.

Why test at the API layer

The API is where business rules live. A UI test that clicks through five screens to confirm a discount was applied is slow and breaks when a button moves. An API test sends one request and checks the price.

AspectUI testAPI test
SpeedSeconds to minutesMilliseconds to seconds
Fails becauseA button moved, a page was slow, or the logic brokeThe logic broke
ReachOnly what the screen exposesBad input, missing permissions, odd sequences
Fits in every pull requestRarelyYes

This holds for a REST API, a GraphQL endpoint or an internal service call. The protocol changes how you build requests, not why you test.

The five main types

TypeQuestion it answersRun it
FunctionalDoes this endpoint do what it should?Every pull request
ContractDo provider and consumers agree on the shape?Every pull request
IntegrationDoes it work with the real database and queue?On merge
LoadHow does it behave under traffic?Before launch, after query changes
SecurityHow does it fail under hostile input?On a schedule, before releases

Functional tests

For each endpoint, check the happy path and the failures:

  • The status code and response body for valid input.
  • Validation errors for missing, malformed or out-of-range fields.
  • Authentication and authorization: a missing token returns 401, a valid token without permission returns 403.
  • Edge cases, such as empty lists, very long strings and duplicate submissions.

Assert on the parts of the response that matter. Over-specified assertions make tests brittle.

Contract tests

A contract test checks that a provider and its consumers agree on field names, types, required fields and status codes. It is most valuable when different teams own the two sides, or when a mobile app talks to a backend that ships on a different schedule. In a microservices setup, contract tests catch a breaking change in one service before it breaks another.

Provider-driven contracts validate the API against its published specification, such as an OpenAPI document. Consumer-driven contracts let each consumer record what it relies on, and the provider's build verifies it still holds.

Integration tests

Integration tests run the API against its real collaborators: the database, the cache, a message queue. Use a disposable environment, such as containers started for the test run, so each run begins from a known state. Focus on the seams where things break: queries, transactions, serialization and migrations.

Load tests

Load tests measure response times, error rates and the point where the service starts to degrade. Define what you are measuring first, for example 95th percentile latency at an expected request rate, and test against an environment that resembles production.

Security tests

Start with the common API weaknesses OWASP publishes:

  • Broken object-level authorization: can user A read user B's record by changing an ID?
  • Weak authentication and missing rate limits.
  • Excessive data exposure and injection through query parameters or bodies.

Automated scanners help, but authorization bugs are logic bugs, and they are best caught by tests you write for your own rules.

Mocking and test data

Mocking replaces a dependency with a controlled stand-in. Use it when the real thing is slow, costly, unavailable or hard to push into a failure state. A mock of a payment provider lets you test what your code does when the provider times out or returns a decline, which is hard to trigger on demand with the real service.

Test data decides whether your suite is trustworthy or flaky:

  • Create the data each test needs and clean it up, so tests do not depend on run order.
  • Use fixtures or factories for repeatable records, and unique values where fields must be unique.
  • Keep real personal data out of test environments. Synthetic data avoids compliance problems.

Running tests in CI

Tests only protect you if they run automatically. Wire them into CI/CD so that every pull request runs the fast tests and a merge runs the full set.

  1. 01Pull requestfunctional and contract
  2. 02Mergeintegration, fresh environment
  3. 03Scheduleload and deeper security, before releases

Fail the build on a failing test and publish the report. Keep the pipeline fast, because a slow suite gets skipped.

What to automate first

If you have no automated API tests today, work in this order:

  1. The critical path: sign-in, the core create-and-read flows, and anything that touches money or personal data.
  2. A smoke test that hits every endpoint once and checks it responds, so deployments fail loudly.
  3. Every bug you fix. A test that reproduces the bug is the cheapest regression testing there is.
  4. Contract checks for any API consumed by another team or a mobile app.
  5. Load and security tests for the endpoints with the most traffic or the most sensitive data.

A small set of tests on the right endpoints beats hundreds of shallow ones. Before calling an endpoint covered, check:

  • The happy path returns the right status and body
  • Invalid and missing input return clear errors
  • A missing token returns 401 and a token without permission returns 403
  • Test data is created and cleaned up by the test itself
  • The test runs in the pipeline, not only on a laptop

How this looks at Techdome

We build Sparrow, an open-source, local-first API testing, mocking and monitoring suite, so the topics in this article are ones we work on directly. Sparrow is built with Rust, TypeScript and SQLite, and it is listed on the Microsoft Azure Marketplace. It reached #4 Product of the Day on Product Hunt in two separate launches.

Our software testing and QA work follows the order above. For a distributed-systems engagement with a global technology services corporation, the results included 100% integration tests (A Global Technology Services & Software Corporation).

Takeaways

  • Test the API directly: it is faster, steadier and closer to the business rules than UI tests.
  • Cover five types over time: functional, contract, integration, load and security.
  • Mock at system edges and use real components inside, and manage test data so runs are independent.
  • Run fast tests on every pull request and slower ones on merge or on a schedule.
  • Start with the critical path, a smoke test and a regression test for every fixed bug.

Have a project like this? Talk to our engineers.

FAQ

Questions readers ask

What is API testing?

API testing sends requests to an application's endpoints and checks the status codes, response bodies and side effects. It validates business logic and integrations without driving the user interface.

What is the difference between functional and contract testing?

Functional tests check that an endpoint behaves correctly. Contract tests check that the shape of its requests and responses matches what consumers expect, so a change does not silently break them.

Should I mock the database in API tests?

Usually not for integration tests, where a real database in a disposable container gives more trustworthy results. Mock third-party services you do not control, and keep the database real where queries matter.

How many API tests are enough?

There is no universal number. Cover the critical flows, every endpoint at least with a smoke test, and each bug you have fixed. Add more where failures would cost the most.

Can API tests replace UI tests?

They replace most of them, since logic is faster to verify at the API. Keep a few end-to-end UI tests for the journeys where the interface itself matters.

Continue reading

More foundry teardowns

View all
Fixed price vs time and materials for a software project
Engineering PracticeOct 15, 2026

Fixed price vs time and materials for a software project

Techdome Engineering
Techdome EngineeringEngineering Team
How long does it take to build an MVP? A realistic timeline
Engineering PracticeOct 15, 2026

How long does it take to build an MVP? A realistic timeline

Techdome Engineering
Techdome EngineeringEngineering Team
Staff augmentation vs dedicated team vs outsourcing
Engineering PracticeOct 15, 2026

Staff augmentation vs dedicated team vs outsourcing

Techdome Engineering
Techdome EngineeringEngineering Team
"Automating mortgage back-office work with n8n"
n8n AutomationOct 15, 2026

"Automating mortgage back-office work with n8n"

Techdome Engineering
Techdome EngineeringEngineering Team
The DevOps lifecycle, from commit to production
Engineering PracticeOct 15, 2026

The DevOps lifecycle, from commit to production

Techdome Engineering
Techdome EngineeringEngineering Team
A practical HIPAA checklist for app architecture
Healthcare AIOct 15, 2026

A practical HIPAA checklist for app architecture

Techdome Engineering
Techdome EngineeringEngineering Team
"Multi-tenant SaaS on PostgreSQL: schema or row-level isolation"
System DesignOct 15, 2026

"Multi-tenant SaaS on PostgreSQL: schema or row-level isolation"

Techdome Engineering
Techdome EngineeringEngineering Team
"n8n vs Zapier vs Make: which one for business automation"
n8n AutomationOct 15, 2026

"n8n vs Zapier vs Make: which one for business automation"

Techdome Engineering
Techdome EngineeringEngineering Team
"PCI DSS for startups: keep card data out of your systems"
Engineering PracticeOct 15, 2026

"PCI DSS for startups: keep card data out of your systems"

Techdome Engineering
Techdome EngineeringEngineering Team
Progressive web apps or native apps for clinical and field tools
System DesignOct 15, 2026

Progressive web apps or native apps for clinical and field tools

Techdome Engineering
Techdome EngineeringEngineering Team
RAG vs GraphRAG: when a knowledge graph is worth it
AI & Machine LearningOct 15, 2026

RAG vs GraphRAG: when a knowledge graph is worth it

Techdome Engineering
Techdome EngineeringEngineering Team
React or Next.js: what to choose for a new product
Our StackOct 15, 2026

React or Next.js: what to choose for a new product

Techdome Engineering
Techdome EngineeringEngineering Team
"Self-hosted n8n in production: queue mode, workers and Redis"
n8n AutomationOct 15, 2026

"Self-hosted n8n in production: queue mode, workers and Redis"

Techdome Engineering
Techdome EngineeringEngineering Team
"Types of AI agents and when each one fits"
AI & Machine LearningOct 15, 2026

"Types of AI agents and when each one fits"

Techdome Engineering
Techdome EngineeringEngineering Team
"WCAG 2.2 AA: what to audit and how to test"
Engineering PracticeOct 15, 2026

"WCAG 2.2 AA: what to audit and how to test"

Techdome Engineering
Techdome EngineeringEngineering Team
+
+
+
+
System DesignOct 7, 2026

Vector Database Evolution: Production RAG Beyond Embeddings

Rahul Joshi
Rahul JoshiChief Executive Officer
Optimizing Next.js 15 Monorepos for Sub-Second TTFB at Scale
Studio ArchitectureSeptember 2026

Optimizing Next.js 15 Monorepos for Sub-Second TTFB at Scale

Rahul Joshi
Rahul JoshiChief Executive Officer
Autonomous Multi-Agent Orchestration: Production Patterns Beyond LangChain
Studio ArchitectureSeptember 2026

Autonomous Multi-Agent Orchestration: Production Patterns Beyond LangChain

Rahul Joshi
Rahul JoshiChief Executive Officer
Engineering Zero-Trust HIPAA Compliant AI Architectures for Telemedicine
Healthcare AIAugust 2026

Engineering Zero-Trust HIPAA Compliant AI Architectures for Telemedicine

Rahul Joshi
Rahul JoshiChief Executive Officer
Production n8n Architecture: Hardened Patterns for Enterprise Pipelines
n8n AutomationAugust 2026

Production n8n Architecture: Hardened Patterns for Enterprise Pipelines

Rahul Joshi
Rahul JoshiChief Executive Officer
The Techdome Blueprint: How We Build & Launch Software Ventures in 8 Weeks
Studio ArchitectureAugust 2026

The Techdome Blueprint: How We Build & Launch Software Ventures in 8 Weeks

Rahul Joshi
Rahul JoshiChief Executive Officer