TOPIC 48/6220 MINNOT STARTED

Your first scripted API check: from a manual request to a repeatable test

You can already send an API request by hand. Learn how to turn one into a script that checks the reply, uses its own data, cleans up, and gives the same answer every run.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: from cooking by feel to a recipe card. The first time you make soup, you taste as you go. It works, but a friend cannot repeat it. So you write a recipe. It gives exact amounts, the steps, and what the soup should taste like. You also say to start with a clean pot and to wash up after.

Daily List is a to-do list app. Tom, the tester, has sent an add-a-task request by hand and seen the reply. Mei, the test lead, asks him to turn it into a script that anyone can run. Leo, the developer, wants it to run every time he changes the code.

The manual request is the cooking by feel. The script is the recipe card. It follows a controlled procedure, checks the reply against declared expectations, uses its own , and arranges cleanup even when a test assertion fails. A repeatable check can still fail when the app or its requirements change.

The tool does not matter at the start. Tom can use a request tool with a scripts tab, or a few lines of Python, or Java. The steps are the same in all of them.

The picture has limits. Soup is eaten, but stays in the app until the script removes it. And a recipe can only check the tastes that you wrote down.

(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)

PLAIN WORDS · 1 in this section
repeatable
able to be done again with the same result

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.

THE REAL JOB Turning a manual request into a controlled check of its response and saved state.

  1. Send it by hand
  2. Pick what to check
  3. Write the script
  4. Make the data fresh
  5. Prove it can fail
From a hand request to a repeatable check

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
Tasting the soup as you cookThe manual request and reply
The written recipe cardThe script
Exact amounts and a taste targetThe status and body check
A clean pot and fresh ingredientsFresh made-up data and a clean start
Washing up at the endDeleting the data the script made
The cook's hands that carry the order to the stoveThe HTTP client library, such as requests, that sends the request and returns the reply
The kitchen helper who calls each dish, runs it and says good or badThe test framework, such as pytest or JUnit, which finds and runs each check
A tag on a recipe card saying: this one is a dish to judgeThe @Test label above a Java method
The shared prep station that every dish starts fromA fixture that does shared set-up, such as getting one login token
A kitchen timerA connect/read timeout such as timeout=10, which is not a total elapsed deadline
Judging the soup, not the potTesting Daily List, not the library

WHERE THIS PICTURE STOPS

  • Soup is eaten. Test data stays in the app until the script removes it.
  • A recipe only checks the tastes you wrote down.
  • A cook can smell a problem. A script sees only what it checks.
  • A kitchen timer rings and you walk away. A time limit makes the check fail with an error.

HOOK

Taste it, write it down, check it, clean up.

REMEMBER IT THIS WAY

A sequence: the real steps, in order.

: set up fresh data, send the request, then check the reply.

What each part of the trick stands for
In the trickWhat it stands for
ArrangeFresh made-up data and a clean start, often from a fixture
ActSend the request
AssertCheck the status and key fields of the reply

TELL A FRIEND

Turn the manual request into with controlled data and declared expectations. Read back saved state, protect credentials and arrange cleanup even after failure.

OFTEN MIXED UP WITH Reading an API automation script. That lesson teaches you to read a script that someone else wrote. This lesson teaches you to build your own from a manual request.

PRACTISE AND KEEP

Sources for this topic — 17 sources
  1. Market practice

    Write scripts to test API response data in Postman (Postman Learning Center) ↗ — Postman · Per the search excerpt, a test is written with a name and a function, and it fails if any check inside fails; checks use the Chai expect style (search excerpt, page not opened)

    Per the search excerpt, a test is written with a name and a function; the test fails if any check inside fails. Checks use the Chai expect style. Practitioner guidance, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  2. Market practice

    Postman test script examples (Postman Learning Center) ↗ — Postman · Shows a named test that checks the response status code, and a test that reads the body as JSON and checks a field (search excerpt, page not opened)

    Vendor documentation. Per the search excerpt, it shows a named test that checks the response status code, and a test that reads the body as JSON and checks a field. Vendor documentation for one tool. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read as a search excerpt only. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  3. Market practice

    Store and reuse values using variables (Postman Learning Center) ↗ — Postman · Per the search excerpt, variables come in five scopes: global, collection, environment, data and local; the narrowest scope wins (search excerpt, page not opened)

    Per the search excerpt, variables come in five scopes: global, collection, environment, data and local; the narrowest scope wins. Practitioner guidance, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  4. Market practice

    Quickstart (Requests documentation) ↗ — Python Requests · Shows reading the status code, calling json() to decode the body, raise_for_status() for error codes, and that a decoded body does not mean the call succeeded (search excerpt, page not opened)

    Shows reading the status code, calling json() to decode the body, raise_for_status() for error codes, and that a decoded body does not mean the call succeeded. Practitioner or vendor guidance, not a standard unless stated. · Checked 2026-11-06

    Primary publisher body opened and relevant sections read on 6 November 2026; selected-section reading, not a claim every page or external link was read. See docs/research/v16-testing-automation-literacy-audit-20261106.md for exact sections, version and limitations.

  5. Market practice

    Get started (pytest documentation) ↗ — pytest development team · pytest finds test functions whose names start with test_ in files named test_.py or _test.py, and a plain assert statement is enough because pytest reports the values behind a failed assert (search excerpt, page not opened)

    Says pytest finds test functions whose names start with test_ in files named test_.py or _test.py, and that a plain assert statement is enough because pytest reports the values behind a failed assert. Official language or tool documentation. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  6. Market practice

    Usage (Representational State Transfer (REST) Assured library wiki) ↗ — Representational State Transfer (REST) Assured project (GitHub wiki) · A Java library for testing web APIs with a given, when, then layout: given holds the request set-up, when sends the request and then checks the reply (search excerpt, page not opened)

    Per the search excerpt, a Java library for testing web APIs with a given, when, then layout: given holds the request set-up, when sends the request and then checks the reply. Practitioner guidance, not a standard. · Checked 2026-11-06

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. V27 supplement, 6 November 2026: relevant primary page sections actually opened; implementation-specific current product guidance, not universal standard. See full V27 audit for version and access scope.

  7. Market practice

    What is the easiest tool to learn for API Automation Testing? (Ministry of Testing forum thread) ↗ — Ministry of Testing · Members mostly name Postman as the easiest start, with a low learning curve and little code, and point to a Java library for testers who can program (search excerpt, page not opened)

    Forum thread. Per the search excerpt, members mostly name Postman as the easiest start, with a low learning curve and little code, and point to a Java library for testers who can program. Practitioner opinion, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read as a search excerpt only. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  8. Market practice

    HyperText Transfer Protocol (HTTP) response status codes (Mozilla developer docs) ↗ — Mozilla (developer documentation) · Status codes come in five classes: informational, success, redirection, client error and server error (search excerpt, page not opened)

    Per the search excerpt, status codes come in five classes: informational, success, redirection, client error and server error. Pages for 400, 401, 403, 404 and 500 describe each. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  9. Market practice

    JUnit 5 user guide (JUnit documentation) ↗ — JUnit team · JUnit Jupiter is the JUnit 5 model for writing tests; the @Test annotation marks a method as a test, and the Assertions class holds checks such as assertEquals (search excerpt, page not opened)

    Official guide. Per the search excerpt, JUnit Jupiter is the model for writing tests in JUnit 5, the @Test annotation marks a test method, and the Assertions class holds checks. The result list showed many guide versions; the 5.14.0 page was the newest seen. Tool documentation, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page for the 5.14.0 guide as listed in a search; read as a search excerpt only. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  10. Market practice

    TestNG documentation (Welcome to TestNG) ↗ — TestNG project · A TestNG suite is one XML file; each test in it lists classes; a method annotated @Test is a test method; before and after annotations wrap tests, tests in a group, or the whole suite (search excerpt, page not opened)

    Official documentation. Per the search excerpt, a suite is described by one XML file, each test in it lists classes, a method annotated @Test is a test method, and before and after annotations run around tests, tests in a group or the suite. Tool documentation, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read as a search excerpt only. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  11. Market practice

    How to invoke pytest ↗ — pytest · r8a-pytest-invoke (node ids with ::, -k expressions). Search excerpt, page not opened.

    Tests are selected by node id with :: and by name expression with -k. · Checked 2026-10-19

    Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  12. Market practice

    Parameters (TestNG documentation) ↗ — TestNG · A method annotated as a data provider returns arrays of parameters that a test method receives by name (search excerpt, page not opened)

    A method annotated as a data provider returns arrays of parameters that a test method receives by name. · Checked 2026-10-19

    Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  13. Market practice

    Test scripts (Postman documentation) ↗ — Postman · Opened body: editing a post-response test and choosing Refresh results reruns tests against the latest response without sending the request again.

    Distinguishes running tests against the latest response from sending the request again. · Checked 2026-10-22

    Relevant page body opened and read. Refresh results runs the edited response checks against the latest reply without sending a new request. The fresh-request decision in Daily List is an editorial teaching inference.

  14. Market practice

    Quickstart (Requests documentation) ↗ — Python Requests · Requests2.34.2 Quickstart,Timeouts:socket inactivity rather than total elapsed download deadline (relevant primary passages opened6November2026).

    Shows reading the status code, calling json() to decode the body, raise_for_status() for error codes, and that a decoded body does not mean the call succeeded. Practitioner or vendor guidance, not a standard unless stated. · Checked 2026-11-06

    Primary publisher body opened and relevant sections read on 6 November 2026; selected-section reading, not a claim every page or external link was read. See docs/research/v16-testing-automation-literacy-audit-20261106.md for exact sections, version and limitations.

  15. Market practice

    Quickstart (Requests documentation) ↗ — Python Requests · Complete Requests2.34.2 Quickstart body actually read 7 November 2026: response/JSON/status distinctions and connect/read inactivity timeout behavior. Runnable exercise separately executed with Requests2.32.5, not a latest-version claim.

    Shows reading the status code, calling json() to decode the body, raise_for_status() for error codes, and that a decoded body does not mean the call succeeded. Practitioner or vendor guidance, not a standard unless stated. · Checked 2026-11-06

    Primary publisher body opened and relevant sections read on 6 November 2026; selected-section reading, not a claim every page or external link was read. See docs/research/v16-testing-automation-literacy-audit-20261106.md for exact sections, version and limitations.

  16. Market practice

    pytest fixture guide ↗ — pytest-dev contributors · Current pytest requesting/scope and complete teardown/finalizer units actually read 7 November 2026; test assertion failure still runs yielded fixture teardown. Setup failure before a known created ID is separately limited.

    Scopes and parameter caching; yield-setup failure; broader/narrower dependency lifetimes. Product/configuration-specific guidance; not a universal team practice. · Checked 2026-11-07

    Selected actual primary passages read, including the specific fixture/marker/collection boundaries described. Daily List rules, people and paths are synthetic; no pytest/xdist execution or complete production fixture design is claimed. Live documentation has no fixed edition claimed.

  17. Market practice

    How to invoke pytest ↗ — pytest · Complete current pytest invocation guide body actually read 7 November 2026: node IDs and -k expressions/name matching. Older source registry excerpt notes retain their historical scope; runnable exercise separately executed with pytest8.4.2.

    Tests are selected by node id with :: and by name expression with -k. · Checked 2026-10-19

    Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.