Turn Your Postman Collection Into Pytest Tests With One Command

https://hackernoon.imgix.net/images/2jqChkrv03exBUgkLrDzIbfM99q2-fh821k0.jpeg

You have a Postman collection with 40 requests. Organized into folders. With test scripts that check status codes. You spent time on this. It's good.

You also have a CI pipeline that has never heard of Postman and doesn't plan to.

These two things have coexisted peacefully for months because nobody wants to be the person who manually rewrites 40 requests as pytest functions. There's also Newman, but Newman runs tests, it doesn't generate code you can read, modify, or version properly.

So the collection documents the API. The CI tests the API. They describe the same system and have never met.

I built postman2pytest to introduce them.

One Command

pip install postman2pytestpostman2pytest \ --collection my_api.postman_collection.json \ --out tests/test_api.pyBASE_URL=https://staging.example.com pytest tests/test_api.py -v

The output is plain Python you can read and edit and commit to version control. No framework lock-in. No runtime wrapper. Just generated Python code.

What the Output...

Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE