So, I have 2 API's, one POST and one GET call. I send some json data in the POST request and it generates an id as response. Then I have to use the id to make a GET request. I am testing for large data, so I need to wait until the id has been generated.
Here is my YAML script-
---
execution:
- concurrency: 30
ramp-up: 1m
hold-for: 10m
scenario: 5K_Export Excel
scenarios:
5K_Export Excel:
store-cache: false
store-cookie: false
use-dns-cache-mgr: false
variables:
calcEngineId: ${calcEngineId}
url: ${url}
data-sources:
# path of .csv files for ${calcEngineId}, ${url} and ${bearerToken}
requests:
- label: Post Pivot Data
url: ${url}/${calcEngineId}/exportPivotDataToExcel
follow-redirects: true
method: POST
headers:
Content-Type: application/json
User-Agent: ApacheJMeter
Authorization: Bearer ${bearerToken1}
content-encoding: UTF-8
think-time: 30s
timeout: 2m
extract-jsonpath:
jobId: $.id
body:
# body of POST request
- label: Export To Excel
url: ${url}/${calcEngineId}/exportPivotDataToExcel/${jobId}
follow-redirects: true
method: GET
headers:
Content-Type: application/octet-stream
User-Agent: ApacheJMeter
Authorization: Bearer ${bearerToken1}
content-encoding: UTF-8
think-time: 1m
timeout: 2m
I am extracting the id and storing it in a variable called jobId through this-
extract-jsonpath:
jobId: $.id
And then I am using this jobId in the url of the GET request as seen above.
When I run this in blazemeter, the GET call shows Bad Request probably due to jobId not being generated yet while making the GET call.
I tried adding a think-time of 60s in between the POST and GET calls but it didn't work.
- label: Think for 1 Minute
think-time: 60000
How do I achieve this? Is there any other way to make an async call in YAML?
I would also like to mention that it is working fine when I have a relatively small data in the body of the POST call. The problem arises when the data is large, lets say 10k-15k lines.
In BlazeMeter's Logs Report there should be
error.jtlfileIt contains request and response data and headers for failing samplers, so you can check what is being send and what is the response.
Additionally you can:
error.jtlfile