Tests with different payloads for same REST resource (endpoint)?
Let's say I have a REST service that allows you to search for rail journeys - and that once you have selected them, you can book them. The endpoint is example.com/service/v1/book, and to create the booking, you use a POST.
Because in reality, when you get to the booking state, the request would require a lot of data, the details of the booking are send as JSON.
For simplicity's sake, let's assume the body just takes the journey legs at the moment:
Re: Tests with different payloads for same REST resource (endpoint)?
IMO, you should use the data driven approach for the same.
It is possible to achieve data driven approach with Open Source edition as well.
All you need is a test case with following steps - a. groovy script step b. rest step Groovy script will have - - a groovy script that reads a data file which consists of test case in each row. - typically a row (test case) contains different input data in column wise. In this case particularly, one of the column can be either request (as that is variable in each test) or keep request in a file and put that file path as column data. - based on the above, you will be able to read the request, and set/update it as request(pay load) for the rest step. - run the rest step from groovy itself - loop the above till all the rows are processed.