How to upload a lot of image through JMeter? - jmeter

I need to upload 100 images through JMeter.
How can I load paths and names into JMeter's HTTP Request quickly?

First use a CSV DataSet that will contain the paths of the list of files to send. Name variable to fileName
Put images in bin folder of jmeter
use Http Request and in field "Send files with the request" use ${fileName} , the right parameter name used by your upload form and the right mime type (you may add a column to csv for this). Set other fields of HTTP Requesf like path, host port to the right values
In thread group configure 100 iterations
Run you test

Related

How to pick json playload from external file in jmeter?

How to pick json playload from external file in jmeter?
I Want to login with multiple users for that I need to add Json request. I need to pick json parameter/Json request from external file. Please let me know the process so that i can pick json parameter from external file.
Json request for example
{"username":"honey#est.com","password":"Phone#123","provider":"","access_token":""}
If you want to read a single line from a file - go for CSV Data Set Config or __StringFromFile() function
If you want to read entire file - go for __FileToString() function
If you have a folder with multiple JSON files and would like to iterate all of them - check out Directory Listing Config
It's also possible to read a file using JMeter's HTTP Request sampler
this way you will be able to use Post-Processors to extract partial data if needed.

how to save whole response message in jmeter

I am receiving below response in jmeter-
[{"Status":"Failed","ErrorDesc":"Duplicate Transaction Id","Amount":"23","CorporateID":"aaa","StatusCode":"ERR0DUP","TransactionReferenceNumber":"1111"}]
I need to save this whole response message.
I tried by using listner,and using csv file as well but only b able to save response like - OK,true
Please help me to save whole response as it is.
You could use the Save the Response to a File Sampler with following configuration
Ensure "Don't add number to prefix" check box is not checked
Set the Minimum Length of sequence number (e.g 6)
You can try with following options for unique file names
Check the Add timestamp
Use ${__threadNum} and/or ${__threadGroupName} fields with file name
response-${__threadGroupName}-{__threadNum}.json
If you want to save response into a variable just use Boundary Extractor with empty left and right boundaries or Regular Expression Extractor and (?s)(^.*) regular expression, see The Boundary Extractor vs. the Regular Expression Extractor in JMeter article for more details to learn more about differences of these two guys.
Example setup:
in the above setup the whole response will be saved into a JMeter Variable and you will be able to refer it as ${response} where required
If you want to save response into a file - go for Save Responses to a file listener, add it as a child of the request which returns the response and configure it like:
the above configuration will store the whole response of the parent sampler into response.txt file in "bin" folder of your JMeter installation

how to run multiple urls in jmeter and it should display on one screen

i am new to jmeter. i would like to run multiple urls at one shot and display the results on one screen. finding hard to config urls through csv file and in jmeter.
my sample url:
http://10.56.34.67:7065/services/sample/2070
http://10.56.34.67:7065/services/sample1/2070
http://10.56.34.67:7065/services/sample2/2070
like this i have more thn 100 url to test it.
could you please tell me the format to store urls in csv file and how to config the csv file in jmeter?
It has simple as
Click Ctrl+0,Ctrl+1 which adds Thread Group and HTTP Request in side
In HTTP Request add ${path} to Path field
In Thread Group choose Loop Count Forever
Add CSV Data Set Config by right click on Thread Group -> Add -> Config Element
CSV Data Set Config parameters :
a. Put the fileanme in Fileanme field
b. Enter in Variable Names path
c. Choose Recycle as False
d. Choose Stop Thread as True
Click Ctrl+R (run)
It will go through all URLs and submit them sequentially
To view results you can add View Results Tree (Click Ctrl+9) and you will see all your requests/responses.
It seems your data here is your URLs.
So instead of using multiple samplers for each URL, you can go for CSV Data config and store all your URLs there and name the column as URL.
you can refer to this in your single http sampler as ${URL}.
Your CSV should look like this
In Server name put ${URL} and in the Thread Group check the forever check box
You don't need CSV for this use case, the easiest way would be going for __StringFromFile() function.
In the HTTP Request sampler put the __StringFromFile() function into "Path" input field like:
The textual function representation is ${__StringFromFile(urls.txt)}, you will need to replace urls.txt with full or relative path to the file where your URLs are listed
That's it, each time the request is called JMeter will read the next line from the file and substitute request path with the string from file:
See Apache JMeter Functions - An Introduction article to get familiarized with JMeter Functions concept

How to hit parameterized url in Apache Jmeter?

This is my test URL " http://appr.seconddemo.org/hitssurveys/survey?uid=113&offerid=311&subid=subvalues&offr_id={Email} "
I want to hit the url 1500 times per second , and want to change the "{Email}" with real value in each iteration.
How it's possible please give me a step by step guide.
Considering that you need to pass the emails from the external file, the most efficient way that we are using in software testing companies is to pass the variable from .csv or .txt files using 'CSV Data Set Config' element of the JMeter.
Please find the steps that you need to follow:
Add a 'CSV Data Set Config' element from 'Config Element' by right-clicking the thread group
Set Filename field with complete path to your .csv or .txt file that contains your emails
Set Variable field as 'Email' [This variable name should be same as you set in your url request]
Ignore first line to False
Set other fields as per your requirement
Now add HTTP Sampler in your Thread Group and set the Protocol, Server Name, Method & Path as instructed in the screenshot:
Create .csv or .txt file and add all emails separated by new line:
Hope this answer is useful.
You can use the CSV Data Set Config. Put all your email credentials in the CSV file and make sure you have put this CSV file in your JMeter /bin directory.
Add a CSV dataset config in your test plan. Your CSV dataset config should be like:
Now in your thread group, define the number of threads you want to execute and then in your sampler put the path as follows:
http://appr.seconddemo.org/hitssurveys/survey?uid=113&offerid=311&subid=subvalues&offr_id=${Email}
Depending on where do your emails live there are following options:
If they are in a text file, each email on a new line you can use __StringFromFile() function like:
If they are in a database you can use JDBC PreProcessor to fetch the data from the database table column and put your request under ForEach Controller
If you need to provide just some random characters you can use __RandomString() function.
More information: JMeter Parameterization - The Complete Guide

Automatically generate HTTP request URLs in JMeter

I have an API call URL similar to this:
http://domain.com/rest/getValues?apiKey=sdfsdf&customerId=2200&timestampBegin=2013-08-15%2018:00:00%20CEST&timestampEnd=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}&timestampBegin=${begin}&timestampEnd=${end}

Resources