Convert a Postman Collection v2.1 JSON file into a runnable pytest test suite using the postman2pytest CLI. Use when the user has a Postman collection (a .postman_collection.json or v2.1 JSON export) and wants to run it as pytest in CI, when migrating from Postman/Newman to a Python-native test stack, when bridging Postman-documented APIs into a pytest-based regression suite, when the user asks to generate pytest tests from Postman, or when the user mentions wanting to keep Postman as the source of truth but run the suite with pytest.
93
100%
Does it follow best practices?
Impact
100%
1.00xAverage score across 2 eval scenarios
Passed
No known issues
A larger Postman Collection (v2.1) has several folders, but the team only wants a pytest
suite for the Orders folder right now. Use the postman2pytest CLI to convert just that
folder, and confirm the output contains only the two Orders requests.
Folder matching in the tool is case-insensitive, so passing orders should match the
Orders folder.
pip install postman2pytest (Python 3.10+).shop.postman_collection.json.Orders folder, writing to tests/test_orders.py.Produce:
tests/test_orders.py - the generated, folder-filtered pytest module.results.txt - the captured output of grep -c '^def test_' tests/test_orders.py and a
line listing the generated test function names (grep '^def test_' tests/test_orders.py).shop.postman_collection.jsonThe collection referenced above is provided inline here (no separate file is shipped):
{
"info": {
"name": "Shop API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Catalog",
"item": [
{
"name": "List products",
"request": { "method": "GET", "header": [], "url": { "raw": "{{BASE_URL}}/products", "host": ["{{BASE_URL}}"], "path": ["products"] } }
},
{
"name": "Get product",
"request": { "method": "GET", "header": [], "url": { "raw": "{{BASE_URL}}/products/1", "host": ["{{BASE_URL}}"], "path": ["products", "1"] } }
}
]
},
{
"name": "Orders",
"item": [
{
"name": "List orders",
"request": { "method": "GET", "header": [], "url": { "raw": "{{BASE_URL}}/orders", "host": ["{{BASE_URL}}"], "path": ["orders"] } }
},
{
"name": "Create order",
"request": { "method": "POST", "header": [{ "key": "Content-Type", "value": "application/json" }], "body": { "mode": "raw", "raw": "{\"item\": \"book\"}" }, "url": { "raw": "{{BASE_URL}}/orders", "host": ["{{BASE_URL}}"], "path": ["orders"] } }
}
]
}
]
}.tessl-plugin
evals
scenario-1
scenario-2