问题
I have a website which needs to upload multiple images at a time. So I want to know what is the process of posting image file through JMeter?
回答1:
You'll need the following:
In HTTP Request Sampler:
- Select "POST" method from drop-down.
- Check "Use multipart/form-data for POST" box
- Provide correct input name, MIME type and path for the file to be uploaded.
See Upload and Download Scenarios with Apache JMeter guide for more details.
回答2:
If you need to upload multiple images best option is to go for a CSV Data Set Config element in Jmeter.
First, add the full path of the images you want to upload comma separately in a file (.csv) as below.
eg: D:\User\Images\img1.png,D:\User\Images\img2.png
Then, add a CSV Data Set Config element most preferably to the top of the script
Next, configure the below elements in the CSV Data Set Config element
- Filename: full path to the csv file
- Variable names: “column name” in the csv file if you have added one or any variable name if you don't have a column name (eg: images)
Note: Make sure to change the delimiter and other optional parameters as required.
- Finally, in a HTTP Request you can use the parameter ${images} to call the images. The CSV Data Set Config element will read the image names from the CSV file and set them in the variable called "images".
Refer the below guide for more information.
https://www.blazemeter.com/blog/how-test-image-upload-functionality-jmeter
来源:https://stackoverflow.com/questions/23405256/how-to-upload-image-through-jmeter