Thursday, 15 September 2011

JMeter how to set Config Element for JSON as payload -



JMeter how to set Config Element for JSON as payload -

i using jmeter load testing application .

as part of payload sending 3 parameters rest webservice phone call

ordersplitjson = {"highpricevendor": "vc4 raj","vendors": {"t1": [{"item_ids_": "194","leaf": [{"orderid": "14101519","cust_id": "22"}],"vendor_id": "9"}]}} customer_id = 22 homedelivery = yes

i loadtesting application 100 users ramp time 2 seconds .

this way have configured , works fine static payload

as part of load test , want login different user every request (means every request want send different parameters )

i guess cant utilize csv dataset config have json payload

could please allow me know how achive load test different payloads

you should still able utilize csv info set config next 1 of below approaches

option 1: alter "delimiter" default comma `,' else won't in json payload, i.e. | , set json payloads csv file , utilize them it.

option 2: don't need have total json in csv info set element, can configured read multiple values multiple variables, i.e. csv file like

vc4 raj, t1, 194, 141519, 22, 9

and variable names in csv info set config be

highpricevendor, vendors, item_ids_, orderid, cust_id, vendor_id

in case can configure request body as:

{"highpricevendor": "${highpricevendor}","vendors": {"${vendors}": [{"item_ids_": "${item_ids_}","leaf": [{"orderid": "${orderid}","cust_id": "${cust_id}"}],"vendor_id": "${vendor_id}"}]}}

see using csv info set config guide instructions on sec approach.

jmeter

No comments:

Post a Comment