I want to perform load test on Asncy APIs by using Taurus + Jmeter, I have two APIs , one uses POST request method , and one of the response from this requested is concatenated with the second API which uses GET request method. Due to Async in nature, when the first API is hit , the second API will make constant calls until it returns the expected response. Below is the yaml script, In the first API call ,there will be one parameter "CreateTime" and when the second API call is completed , from changing the status from InProgress to Done , there will be another parameter "UpdateTime", Now I need to calculate the the time difference with these values. How can i handle that ? Along with that I need to capture the avg of all the time difference when running the test for multiple concurrent users and display on the console and output file.
- label: Step One
url: ${__V(First API, '')}
method: POST
headers:
Content-Type: application/json
Authorization: ${token}
body:
// actual body
extract-jsonpath:
Value: $.value
- while: ${JMeterThread.last_sample_ok}
do:
- url: ${__V(Second API, '')}/${Value}
method: GET
headers:
Content-Type: application/json
Authorization: ${token}
assert-jsonpath:
- jsonpath: $.status
validate: true
expected-value: "InProgress"
extract-jsonpath:
status: "$.status
- label: Step Two
url: ${__V(messages, '')}/${Id}
method: GET
headers:
Content-Type: application/json
Authorization: ${token}
assert-jsonpath:
- jsonpath: $.status
validate: true
expected-value: "Done"
Used ${JMeterThread.last_sample_ok}
I want to perform load test on Asncy APIs by using Taurus + Jmeter, I have two APIs , one uses POST request method , and one of the response from this requested is concatenated with the second API which uses GET request method. Due to Async in nature, when the first API is hit , the second API will make constant calls until it returns the expected response. Below is the yaml script, In the first API call ,there will be one parameter "CreateTime" and when the second API call is completed , from changing the status from InProgress to Done , there will be another parameter "UpdateTime", Now I need to calculate the the time difference with these values. How can i handle that ? Along with that I need to capture the avg of all the time difference when running the test for multiple concurrent users and display on the console and output file.
- label: Step One
url: ${__V(First API, '')}
method: POST
headers:
Content-Type: application/json
Authorization: ${token}
body:
// actual body
extract-jsonpath:
Value: $.value
- while: ${JMeterThread.last_sample_ok}
do:
- url: ${__V(Second API, '')}/${Value}
method: GET
headers:
Content-Type: application/json
Authorization: ${token}
assert-jsonpath:
- jsonpath: $.status
validate: true
expected-value: "InProgress"
extract-jsonpath:
status: "$.status
- label: Step Two
url: ${__V(messages, '')}/${Id}
method: GET
headers:
Content-Type: application/json
Authorization: ${token}
assert-jsonpath:
- jsonpath: $.status
validate: true
expected-value: "Done"
Used ${JMeterThread.last_sample_ok}
Share asked Mar 4 at 9:00 Sagar KoviSagar Kovi 11 Answer
Reset to default 0You can put your While
block under the Transaction
block which measures the cumulative execution time of its children and reports it as a separate transaction.
It will generate a Transaction Controller, see the documentation on the test element and What is JMeter’s Transaction Controller? article for more comprehensive explanation with examples.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745053612a4608534.html
评论列表(0条)