If we have dynamic values in JMeter, in Response Body, Response Headers, and Request Headers, then we can correlate using Post Processors. But If we have dynamic values in the Request Body, then how can we correlate.
Could anybody please help me.
Where do these "dynamic values" come from?
If you need to populate them with the data from the response - correlation approach applies
If you need to populate them from external sources - it's called parameterization, the most commonly used approach is CSV Data Set Config
If you need to provide random/unique values - look at JMeter Functions
Related
Why I cannot click on Parameters tab in HTTP Request section after I insert JSON body data in Body Data tab? I tried to define correlation and of course this will require us to define the variable as well. Just wondering, after I'm done with correlation part, how can I insert the variable in Parameters if it is disabled?
You can't send Parameters and Body Data, you must choose only one option of sending request body
If you need to send extra parameters in additional to request body then use query parameters in Path field, for example
path?parameter1=value¶meter2=value2
If you want to variablize/correlate the JSON request body - you can put the relevant JMeter Functions/Variables directly into "Body Data" tab
as you can see all the functions/variables are getting replaced by their respective values.
Also most probably you're getting JSON as the response so it makes sense to consider switching to JSON Extractor or even better JSON JMESPath Extractor for the correlation.
Not able to get response data from dynamic values for the correct requests,
i added debug sampler and also regular expression extractor still not able to get the correct response from the value i am getting same data for dynamic value , please can any one help me to resolve it.
How to parameterize request if I am getting something similar to the following for login POST request in body data tab.
"{\"msg\":\"method\",\"method\":\"login\",\"params\":[{\"user\":{\"username\":\"testuser\"},\"password\":{\"digest\":\"5811c74a581ffdb892ab9eddfb9cf2d21772a98332a59de6aa26989e01f84057\",\"algorithm\":\"sha-256\"}}],\"id\":\"7\"}"]
It's generally easy to correlate when we are getting in Parameters TAB, but in cases how we can proceed? For all further requests - it's the similar case.
I tried to switch to Parameters TAB, but it says that it can not be converted to that format.
So How we can proceed?
The same way, just substitute hard-coded (recorded) values with the relevant JMeter Variables directly in the request body like:
"{\"msg\":\"method\",\"method\":\"login\",\"params\":[{\"user\":{\"username\":\"${username}\"},\"password\":{\"digest\":\"${password}\",\"algorithm\":\"sha-256\"}}],\"id\":\"${id}\"}"]
The most commonly used for parameterization test element is CSV Data Set Config, however other options exist.
I've used Fiddler to capture these HTTP calls. Here's the problem:
I have a HTTP-POST data that looks like below:
Notice how it has many 'employeeIds' and also 'shiftSumIds'.
Now, these Ids are from a previous HTTP response that looks like below:
Is there an easy way to extract those Ids and prepare the POST data? Thanks in advance.
--Ishti
Short answer is JSON Path Extractor available via JMeter Plugins which is designed for getting "interesting" values from JSON data. See Using the XPath Extractor in JMeter guide (look for "Parsing JSON" chapter) for installation instructions and some form of JSON Path language reference.
If it is not enough and you will need some assistance in constructing JSON Path query and building HTTP Request from it - please include text version of response and request using i.e. http://paste.org service as reading large amount of text from small screenshot isn't very handy and chance of getting the answer is minimal
Jmeter: I tried to Parameterize the headers(pass about 5 dynamic headers) in "HTTP header manager" using "CSV data set config". But i could not, can anybody help me??
Just use the CSV data setup variables in the HTTP header manager.
Can you be more specific on where you're stuck?
YouTube tutorial on using CSV data with JMeter:
http://www.youtube.com/watch?v=aEJNc3TW-g8
Blog that explains exactly what to do:
http://community.blazemeter.com/knowledgebase/articles/65138-using-csv-data-set-config
If you need to add 5 dynamic headers one by one, i.e. one header per request just change the value on each consecutive request - it's pretty easy doable, just place your CSV Data Set Config as a child of required request, the same for HTTP Header Manager.
If you need to add all 5 headers before any testing starts - you'll need to consider do it in a separate thread group or use combination of Loop Controller with Once Only Controller
If none above is applicable to your test scenario try updating it and provide as much information as you can.