Skip to content
Tutorials Center
My learning

Topics

Lesson 20 of 30 ยท Advanced API Testing

Software testing types and design techniques for APIs

Understand unit, integration, system and acceptance testing, functional versus non-functional tests, black, white and gray box, and design API cases with boundary values and decision tables.

An API test is one kind of software test, and the same vocabulary that testers use for web pages and apps applies to it. If you can place each test in the right category, you can answer two practical questions: what should I automate in Postman, and what needs another tool. This lesson gives you the map: levels of testing, types of testing, the box models, and the classic test design techniques that turn a requirement into a short list of good test cases.

The techniques matter most. A badly designed suite with 500 tests can miss a bug that a well-designed suite of 40 tests catches. You will apply boundary value analysis, equivalence partitioning, decision tables and state transitions to a real API rule, and run the generators in plain JavaScript.

Levels of testing

Levels describe how much of the system a test touches.

Level What it checks Who usually writes it API example
Unit One function or class in isolation Developers calculateTotal(items) returns the right sum
Component One service with its dependencies replaced by fakes Developers, testers The orders service with a fake payment client
Integration Several parts working together, such as service plus database, or two services Developers, testers POST /orders really stores a row and calls the payment service
System The whole product through its public interface Testers Register, log in, order and pay, through HTTP
Acceptance Does it meet the business need? Product owner, testers, sometimes customers "A customer can reorder a past order in two calls"

Postman lives mostly at the integration and system levels, because it talks to a running API over HTTP. Integration testing itself has strategies. Big-bang joins everything at once (fast to set up, hard to debug). Top-down tests from the entry point downward, using stubs for lower layers. Bottom-up starts with the lowest modules and uses drivers to call them. Sandwich (hybrid) mixes the two. With APIs, mocks and stubs are the standard way to isolate a part, so see Saved examples, documentation and mock servers.

The shape of a healthy suite is usually a pyramid: many fast unit tests, fewer integration tests, and a small number of end-to-end system tests, because the higher you go the slower and more fragile tests become. See API testing strategy and test design for where API tests sit in that pyramid.

Types of testing

Types describe what quality you are checking, independent of level.

Functional testing asks "does it do the right thing?": correct output, status codes, validation, business rules. This is the bulk of Postman work.

Non-functional testing asks "how well?":

  • Performance, load and stress. Load testing applies the expected traffic; stress pushes beyond the limit to see how and where it breaks; spike testing applies a sudden surge; endurance (soak) testing runs for hours to find leaks. Postman can do light versions (see Monitors, performance and load basics); serious load needs a dedicated tool.
  • Security. Authentication, authorization, injection, data exposure (see Security testing basics for APIs).
  • Reliability and recovery. Does the service survive restarts and failures, and come back with data intact?
  • Compatibility. Different API versions, client libraries, or content types.
  • Usability and accessibility. For APIs this means clear error messages and good documentation rather than screens.

Regression testing re-runs existing tests after a change to confirm nothing old broke. Smoke testing is a tiny, fast check that the build is alive at all (the login endpoint answers, the health check is green). Sanity testing is a quick, narrow check that a specific fix works before deeper testing. Exploratory testing is unscripted: you explore, learn and try odd inputs at the same time. It finds problems that scripts never think of, and good API testers do it in Postman's request builder before they automate anything.

Black, white and gray box describe how much you know about the inside:

  • Black box: you know only inputs and outputs. All HTTP API testing from outside is black box by default.
  • White box: you can see the code, so you target statements, branches and paths (coverage).
  • Gray box: you know some internals, such as the database schema or the architecture, and use it to design smarter tests, for example checking a table row after a POST.

Test design techniques

These techniques apply to any input, but are ideal for API request fields.

Equivalence partitioning

Divide the possible inputs into groups that the system should treat the same way, then test one value per group. Suppose POST /orders accepts quantity from 1 to 10. There are three partitions: below the range (invalid), inside (valid), above (invalid). Testing 3, 4 and 5 adds almost nothing over testing 3.

Boundary value analysis

Bugs love edges: < written instead of <=, off-by-one counters. For the range 1 to 10, test 0, 1, 2 and 9, 10, 11 (the boundary and its neighbors). Together with partitioning this is the cheapest strong technique you have.

Decision tables

When the result depends on combinations of conditions, write them down. A shipping rule: free shipping if the order total is at least 50 and the customer is a member, or if the total is at least 100. A table lists each combination of conditions and the expected action, and every row becomes a test.

State transition testing

When behavior depends on history, model the states and the allowed moves. An order goes new to paid to shipped; paying a shipped order or shipping a new one should be rejected. Test each valid transition and a sample of invalid ones.

Error guessing and use cases

Error guessing uses experience: empty strings, very long strings, null, negative numbers, unicode, duplicate submissions, wrong content type. Use-case testing follows a realistic user story from start to finish, which is what a chained collection does.

From rule to cases, by program

The first stand-in turns one numeric rule into boundary and partition test inputs, and checks a function against them. It uses a rule that could have been written with an off-by-one bug.

JS Boundary values and partitions for a quantity field

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The three partition tests all pass for the buggy version. Only the boundary value 10 exposes it, which is exactly why you run both techniques.

The second stand-in builds a decision table from the shipping rule and generates the full list of cases, including the expected result.

JS A decision table for a shipping rule

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Six rows give complete coverage of the rule. In Postman you would put those rows into a CSV file and run one request against it with the Collection Runner (see The Collection Runner and data-driven testing).

Defects: severity and priority

When a test fails, you file a bug report. Two words are often confused:

  • Severity is how badly the defect damages the product (a crash and data loss is critical; a typo in an error message is minor).
  • Priority is how soon it must be fixed, a business decision. A typo on the home page of a launch may be high priority and low severity; a crash in a rarely used admin export may be high severity and low priority.

A good API bug report contains the request (method, URL, headers, body), the actual response, the expected response and the environment. A Postman request exported from the collection is the best reproduction you can give. The usual life cycle is new, assigned, open, fixed, retested, closed, with reopened if the fix fails.

A practical checklist per endpoint

  1. Happy path with valid data, status and body shape.
  2. Boundary and partition values for each numeric or length-limited field.
  3. Missing, null and wrongly typed fields.
  4. Authentication missing, expired, and wrong role.
  5. State and combination rules (decision table or state machine).
  6. Idempotency and duplicates for POST and PUT.
  7. Response time within the agreed limit.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. A field accepts ages 18 to 65. Which set contains the boundary values?

    Boundary value analysis tests each edge and its neighbors on both sides, so 17, 18, 19 and 64, 65, 66.
  2. 2. Which testing level checks several parts working together, such as a service and its database?

    Integration tests exercise the interaction between parts, which is where most Postman tests sit.
  3. 3. A tester knows the database schema and checks a row after a POST request. What is this called?

    Gray box testing combines external behavior with partial knowledge of the internals.
  4. 4. A crash that loses data in a rarely used export feature is best described as

    Severity measures damage; priority measures urgency. The two can differ.
  5. 5. When does a decision table help most?

    Each combination of conditions becomes a row, and each row becomes a test with an expected result.

Summary

  • Levels (unit, component, integration, system, acceptance) say how much is tested; types (functional, performance, security, regression, smoke, exploratory) say what quality is tested.
  • Postman works mainly at the integration and system levels, as black or gray box tests.
  • Equivalence partitioning picks one value per group; boundary value analysis targets the edges.
  • Decision tables handle combinations of conditions; state transition tests handle behavior that depends on history.
  • Severity is damage, priority is urgency; report bugs with a reproducible request and response.

Next: Security testing basics for APIs.