Skip to content
CheckcraftDownload
Practical workflow

Data-driven API testing with CSV and Excel exports

Checkcraft is a desktop app for checking APIs and logs without code, with a free edition. Download, no sign-up →

A request needs repeating with several inputs. Manual copies make it harder to track which input failed.

Checkcraft ·

Get help with your first test →

Checkcraft Pro

This workflow needs an active Pro license and a build containing Pro scenarios. See the edition details.

Prepare the source request

Create a Pro scenario using a saved check and request. The example assumes {{customer}} is used in the relevant request field and the test service returns HTTP 200 with status CREATED. Adjust these illustrative expectations for your own contract.

id,name,var.customer,expect.status,expect./status
normal,Normal order,alice,200,CREATED
second,Second customer,bob,200,CREATED

Preview the dataset

Paste CSV in the scenarios and data tab and preview the parsed rows. Keep a unique, stable id when editing a row. var.customer defines a variable, expect.status the HTTP status and expect./status the JSON field value. These are distinct expectations.

API call diagram: method and URL, headers, body, status and response body, logs and database

Use an Excel worksheet

Create the same columns in Excel and export CSV. This does not claim native binary XLSX import. Verify UTF-8, comma delimiters and quoting around values containing commas. Spreadsheet regional settings may produce another delimiter.

Run and retry failures

Save the scenario, choose an environment and run the dataset. After fixing the cause, retry failed rows from the last run of that scenario. Check prior side effects before repeating writes. Functional dataset execution is not load generation.

Layers of an API call check: status, headers, body, calculations, logs, database

What data-driven testing is

One request runs over a table of values: each row is a separate case with its own input and expectation. One test covers equivalence classes and boundary values without copy-paste.

qty,promo,expectedStatus,expectedTotal
1,,201,1000
2,SALE10,201,1800
0,,400,
-1,,400,
1000,,422,

Expectation columns matter as much as inputs. Without them the test only sends requests and checks nothing.

CSV traps from Excel

ProblemWhat it looks likeFix
DelimiterSome locales save with semicolonsSave as CSV UTF-8 with commas or set the delimiter in the tool
EncodingNon-Latin text turns into garbageSave in UTF-8
BOM at the startThe first column is named \ufeffqtySave without BOM or handle it when reading
Decimal comma10,5 reads as two columnsUse a dot or quote the value
Leading zerosCode 007 became number 7Set the cell format to text before typing
DatesExcel changes the date formatWrite ISO 8601 dates as text

Running in Newman and pytest

Newman

newman run orders.postman_collection.json -e test.postman_environment.json -d data.csv

CSV columns become variables: {{qty}} in the request body, pm.iterationData.get("expectedStatus") in the test.

pm.test("status per table", () => {
  pm.response.to.have.status(Number(pm.iterationData.get("expectedStatus")));
});

pytest

import csv, pytest

with open("data.csv", encoding="utf-8-sig") as f:
    CASES = list(csv.DictReader(f))

@pytest.mark.parametrize("case", CASES, ids=lambda c: f"qty={c['qty']}")
def test_order(case, api):
    r = api.post("/orders", json={"sku": "A-1", "qty": int(case["qty"]), "promo": case["promo"] or None})
    assert r.status_code == int(case["expectedStatus"])

The utf-8-sig encoding strips a BOM if the file was saved from Excel.

How to build the case table

  • One representative per class: normal value, zero, negative, too large.
  • Boundaries: minimum, minimum minus one, maximum, maximum plus one.
  • Combinations that affect each other: promo and quantity, plan and region.
  • A row with empty optional fields.
  • One row, one meaning. If a row checks three things at once, a failure does not say which broke.

Value selection techniques are covered in API automation for manual testers.

Frequently asked questions

How do I run a Postman collection with CSV data?

With newman run collection.json -d data.csv. Columns become {{name}} variables and are available in tests via pm.iterationData.get.

Why is a CSV from Excel read wrongly?

Usually a semicolon delimiter, a non-UTF-8 encoding or a BOM at the start. Save as CSV UTF-8.

Next step

Start with Free, add Pro for this workflow

This workflow needs Pro. Requests, response rules and log correlation are free with no time limit, so you can try the app first and add Pro when you need it.

Download FreeDownload and first run

No sign-up or email needed, the archive is ready in a couple of minutes. See the edition limits.

Start with the linked example and compare its result with your own test requirement.

Ask a person

Get help with your first test

Tell us what you want to test or where you got stuck. We can help you start Checkcraft, choose an example and understand your first run. You can ask before downloading.

The Telegram group is public: do not post passwords, tokens or confidential work data. A description of your task is enough to start.

You can also email us support@checkcraft.ru

No account required. We will reply by email. This is a support request, not a newsletter subscription.