What Is API Testing?
An API (Application Programming Interface) is how two programs talk to each other. When you tap "Log in" in an app, the screen sends your email and password to a server API, and the API answers "OK, here is your account" or "wrong password".
API testing means sending requests straight to the API and checking the answers, without using the screen at all.
A REST API in one example
Most web APIs today are REST APIs that send and receive JSON. Open this link in your browser:
https://jsonplaceholder.typicode.com/users/1
You get back JSON like this:
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz"
}
That is an API response. Your browser just made a GET request. JSONPlaceholder is a free fake API we use in all the examples in this track.
Why test the API and not only the UI?
- Earlier: the API is often ready before the screens, so you can start testing sooner.
- Faster: an API test runs in milliseconds. A UI test that does the same thing takes seconds.
- More stable: no locators, no page loads, no animations.
- Deeper: you can send data the UI never allows, like a negative quantity or a missing field, and check the server rejects it. Many security bugs are found this way.
Where API tests sit in the test pyramid
| Layer | How many | Speed |
|---|---|---|
| UI / end-to-end tests | Few | Slow |
| API / integration tests | Many | Fast |
| Unit tests (developers) | Most | Fastest |
A good rule: check business rules at the API level, and use UI tests only for the main user journeys.
Tools you will meet
- Postman: the most popular tool for testing APIs by hand (lesson 3).
- REST Assured: a Java library for automated API tests (lesson 6).
- Others: Insomnia, Bruno, curl, Playwright's request API, Karate.
Next: before you test an API, you need to read HTTP. That is the next lesson.