I have an API service, which accepts JSON input and gives multiple JSON in a single response.
In first CSV, I have endpoint which I will access by HTTP request, and the input JSON which I will post with it.
In second CSV, I have API endpoints, index of response JSON, and unique id in response which I need to validate.
Sample CSV 1
/API/EndPoint/1
json_request_post_1.json
/API/EndPoint/2
json_request_post_2.json
Sample CSV 2
- API Endpoints
- index of JSON response
- Unique id in respective responses
Data:
/API/EndPoint/1
0
CS-3736f6a7b0f05d38abf69435a261fb557c5d58ca6deacedc06480d4032603105
/API/EndPoint/1
1
CS-51c1c894d1b96fc93d458f152029d9ffe3efda81c099ea1294e085e53a53b1a5
/API/EndPoint/2
0
CS-2580621b29babb61037e386f127e9cc7060c691100701982c6c07458ea86a924
/API/EndPoint/2
1
CS-3c5166f79e23c8c227368de9d3bb7d1eabd38c191ea519054fee249d091c67a1
/API/EndPoint/2
2
CS-5f3a65daf8fc289b4e5ec174cac4be4ea0c28d0248faf81515865c6c48819f87
So I need to send a request to /API/EndPoint/1
once and need to verify twice if id[0]
and id[1]
are getting correct id values.
Then I have to move to /API/EndPoint/2
and check if id[0]
, id[1]
and id[2]
are getting correct id values.
I have put a while controller
which contains –
- HTTP request
- CSV dataset config based on CSV 1
Inside this while controller
I have put another while controller
which contains –
- A bean shell sampler - return
ctx.getPreviousResult().getResponseDataAsString();
- CSV dataset config based on CSV 2
- JSON path assertion which takes JSON path based on index value of CSV 2 (Column 2).
Is there any way to stop inner loop after count=2
in first iteration, and start from the same point and do it 3 times in iteration 2. Basically iterate through CSV 2 on repeated values on API endpoints.
Or some other way you would suggest?