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.
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,CREATEDPreview 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.

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.

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
| Problem | What it looks like | Fix |
|---|---|---|
| Delimiter | Some locales save with semicolons | Save as CSV UTF-8 with commas or set the delimiter in the tool |
| Encoding | Non-Latin text turns into garbage | Save in UTF-8 |
| BOM at the start | The first column is named \ufeffqty | Save without BOM or handle it when reading |
| Decimal comma | 10,5 reads as two columns | Use a dot or quote the value |
| Leading zeros | Code 007 became number 7 | Set the cell format to text before typing |
| Dates | Excel changes the date format | Write ISO 8601 dates as text |
Running in Newman and pytest
Newman
newman run orders.postman_collection.json -e test.postman_environment.json -d data.csvCSV 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.
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 runNo 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.