Search code examples
resttestingpostmanpostman-testcase

Postman: Sending different bodies per request for testing?


We have this REST endpoints at work we need to make some tests for in Postman. The endpoints are just accepting a json body which we are providing in the "Body" field and the tests are covering basic stuff: Mostly a good request and different types of bad requests.

The thing is that I have for each endpoint several requests, each one testing a different body with its own test asking for a specific response code, mostly a correct body (200) and several incorrect bodies (400), and it looks like to me that I'm missing something in the testing workflow, as having to create a new, specific request just to change the body of it and the expected response seems to be overkill.

So, am I missing something when working with Postman? Do I have to create for each case a brand new request and re-input the same body just to change some values (Or empty it)? Am I approaching this task in an incorrect way?


Solution

  • At the end we've settled with having a default set of tests for each endpoint in different requests, as it would made (hopefully) maintenance easier than having to deal with the body requests through code.

    For reference, if the endpoint is called "foo", we create a folder, and inside the folder foo_descriptiveName1, foo_descriptiveName2 and so on.