skip to Main Content

I have a similar but extended question for the below question.
How to pass parameter and json both in http request request body in jmeter??

I will take the same example as mentioned in the above question/link.
Have to pass multiple parameters,

UserId=47
meeting={
    "DeviceID":${deviceID},
    "NetworkCarrierName":"VODAFONEIN",
    "BatteryValue":"22",
    "AppVersion":"1.1.3",
 }

As you can see, DeviceID have a value from variable deviceID. I want to pass all these parameters and JSON in one single http request body.
What would be the approach for this?

2

Answers


  1. Chosen as BEST ANSWER

    In parameter I have to add the variable for value part for whichever key I want to refer to. It will work fine. This image shows that..


  2. The same approach will work fine, you can use JMeter Variables anywhere in your test plan, if there is a User Defined Variable or a pre-defined variable or a variable coming from a Post-Processor – JMeter will substitute the variable placeholder with its respective value in the runtime:

    enter image description here

    If you’re uncertain regarding how to properly build your request the easiest is just recording it using HTTP(S) Test Script Recorder

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search