0

We have 100+ payloads request to test the IBM MQ in JMeter. Each payload request has dynamic RFH2 header values which we keep in separate files. Is it possible to create a single script which can create n numbers of parameters in request body based on the CSV files. I am using JSR223 sampler to send my payload request.

Request 1 Ex : Values: "Test = Sample" Request body: rfh.setFieldValue('usr', 'Test', 'Sample')

Request 2 Ex: Values: Script = JMeter, ID= 10 Request body: rfh.setFieldValue('usr', 'Script', 'JMeter') Request body: rfh.setFieldValue('usr', 'ID', '10')

May i know how can i create dynamic request body in JMeter based on available header values in each request.

1 Answer 1

1

If you put the desired header names/values in the CSV file you can read them into JMeter Variables using CSV Data Set Config

enter image description here

In the JSR223 Sampler you can access the variables using vars shorthand for JMeterVariables class instance like:

rfh.setFieldValue('usr', vars.get('name'), vars.get('value'))
Sign up to request clarification or add additional context in comments.

1 Comment

Hi @Dmitri, thanks for your answer. My problem here is each payload will have multiple header values associated to it. for ex: 1st request will have two set of header values and 2nd request will have 10 set of header values. Here, how can i re-create this request dynamically for n number of times. ex: 2 set of headers values then i need to pass this line(rfh.setFieldValue) two times to place the value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.