How to pass dynamic data as Body Data in JMeter while doing performance testing?

36 Views Asked by At

Can you help me to pass dynamic data as body data for the below sampler.

{"dealer_code":"30274","version":"566","preview_date":"","exterior_color":{"name":"Energetic Orange Metallic","prcode":"F14 4M4M","mrdp":0,"price":"600"},"car_configurator_model_code":"C113KZ-GPJAPJA-GPLAPLA-GWZBWZB-GW05W05","model_year":"2023","sfid":"01t9q000000FRoGAAW","sub_brand":"PV","model_code":"C113KZ/23"}

enter image description here

I tried to pass the details as parameter but it didn't work.

1

There are 1 best solutions below

0
Dmitri T On

You can substitute hard-coded values with the appropriate JMeter Functions or Variables directly in the "Body Data" tab of the HTTP Request sampler:

{
  "dealer_code": "30274",
  "version": "566",
  "preview_date": "",
  "exterior_color": {
    "name": "Energetic Orange Metallic",
    "prcode": "F14 4M4M",
    "mrdp": 0,
    "price": "600"
  },
  "car_configurator_model_code": "${configuratorModelCode}",
  "model_year": "${modelYear}",
  "sfid": "01t9q000000FRoGAAW",
  "sub_brand": "${subBrand}",
  "model_code": "${modelCode}"
}

enter image description here

The variables values should either be correlated (i.e. using data from the previous response) or parameterized using external data source (i.e. using CSV Data Set Config)