CtrlK
BlogDocsLog inGet started
Tessl Logo

golikovichev/postman2pytest

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

1.00x
Quality

100%

Does it follow best practices?

Impact

100%

1.00x

Average score across 2 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-1/

Convert only one folder of a Postman collection

Problem

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.

Steps

  1. Install the tool: pip install postman2pytest (Python 3.10+).
  2. Save the collection below as shop.postman_collection.json.
  3. Run the converter filtering to the Orders folder, writing to tests/test_orders.py.
  4. Confirm the generated module defines exactly two test functions (the two Orders requests) and none of the Catalog requests.

Output specification

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).

Provided input file: shop.postman_collection.json

The 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"] } }
        }
      ]
    }
  ]
}

CHANGELOG.md

CONTRIBUTING.md

main.py

README.md

REFERENCE.md

SECURITY.md

SKILL.md

tessl.json

tile.json