I have csv file contains URL and port no.i want to pass in all samplers.How to do that?
I have tried ${URL},${Port_no}.but,it is of no use
It's working, If you CSV holds for example:
www.google.com,80
Configure the CSV Data Set Config:
And add HTTP Request with Server Name as ${URL} and port as ${Port_no}
If there is only 2 values you would like to parameterize the easier option would be:
Pass the URL and the Port_no via -J command-line arguments like:
jmeter -JURL=http://example.com -JPort_no=443
Add HTTP Request Defaults configuration element to your Test Plan and refer the properties using __P() function like:
${__P(URL,)}
${__P(Port_no,)}
In your HTTP Request samplers leave the relevant fields blank - they will be populated from the HTTP Request Defaults.
Related
I am using graphql in jmeter for API testing. Where in graphal we have the query and variable section.
My query would require a client ID which is int. Where as in Variable if I try to pass "{clientid : ${clientid}}"(here I am passing the CSV config variable, for testing the app for multiple users). But it is throwing an error like $ is unauthorised and expecting a (json,null,true or false).
Please help me out how I can pass the clientid which is a csv config variable.
Thanks in advance.
It looks like your CSV Data Set Config setup is not very correct so the JMeter Variable placeholder isn't getting substituted with its respective value from the CSV file.
We cannot help without seeing first couple of lines of the CSV file and your CSV Data Set Config setup so far I can only suggest re-visit the configuration and cross-check it with JMeter Documentation
You can observe JMeter Properties and Variables with their values using Debug Sampler and View Results Tree listener combination, if you don't see clientid line there - the variable is not set and JMeter sends it as it is, to wit "{clientid : ${clientid}}" and doesn't substitute ${clientid} with the value from CSV
My registration form is accepting body in JSON format, and I need to run the test with 5 different user names.
How do I pass JSON as request body? Also I was unable to pass parameter from CSV file. How can I solve this issue?
Add CSV Data Set Config to your Test Plan
Configure it like:
Filename: full path to the file with your emails
Variable Names: anything meaningful, i.e. EmailId
In your HTTP Request sampler copy the recorded value to Body Data" tab and replace hard-coded email with JMeter Variable like:
{"EmailId" : "${EmailId}"}
In Thread Group set "Number of Threads" to 5
Next time you run your test JMeter will read next line from the file.csv and substitute the ${EmailId} variable with the value from the CSV file.
See Using CSV DATA SET CONFIG article for more information on parameterising your JMeter tests via CSV files.
URL format is
www.something.com/something/api/{uuid}?code=gomundw0gjq2kbvc3g63whfr9usap5rurjaq5vui5vm6xbt9hhqa8hbcpto4yatwpn26v42t9
I need to make several calls to this GET Url and check performance of the feature.
uuid here is not just the UUID , but is specific to my application
UUID= accountid+identifierid+uuid, which will look like 1234+1234+123e4567e89b12d3a456426655440000
How should I arrange my Jmeter Test Plan.
My Plan would be:
write UUID generated to a file
Using any preprocessor call the file from file and write program to append to a different value in the csv which is account/identifierid.
Please help on this, can some one explain how I should logically arrange my test plan and code to get data to parameterize my path in HTTP Request sampler.
Thanks in Advance
You need to get accountid+identifierid information stored into CSV file. This is something you need to do on your own.
You can use CSV Data Set Config in order to get the information from that file while your test is running, example configuration would be:
UUID can be generated using __UUID() function
So your HTTP Request sampler configuration would be something like:
I have an API call URL similar to this:
http://domain.com/rest/getValues?apiKey=sdfsdf&customerId=2200×tampBegin=2013-08-15%2018:00:00%20CEST×tampEnd=2013-08-19%2018:00:00%20CEST
I would like to dynamically change the time stamps, as well as the customerId, picked from a given set of timestamps and customerIds. Is this possible to do in Jmeter (preferably through GUI)?
Assuming that you are have inputs coming from external CSV file, you can use CSV data set config as explained here.
Your test plan will look something like
Thread groups
CSV Data Set config (define the file path and the variable names. You will be able to read these variables in request.
HTTP Sampler
http://domain.com/rest/getValues?apiKey=sdfsdf&customerId=${custid}×tampBegin=${begin}×tampEnd=${end}
I want to use CSV Data Set Config to modify the path of a HTTP Request.
My CSV file:
120,120
121,121
My CSV variable names: paraa, parab.
My http request path: /my/path/with/?{paraa}/?{parab}/.
I tried and I failed.
Is there anyway to work this around?
Seems that you incorrectly refer jmeter variables.
Try
/my/path/with/${paraa}/${parab}/
instead,
where ${paraa}, ${parab} refer corresponding values extracted in CSV Data Set Config: