In performance testing scenarios, you might come up with image file uploading-downloading functionality in any web application. In this blog, I will explain to you how we can upload different image files in JMeter.
For creating image files upload scenario in JMeter, follow below steps
- Launch Apache JMeter (I am using 5.0 version)
- Right-click on Test Plan--> Add-->Threads-->Thread group
- Right click on Thread group--> Add--> Sampler--> HTTP Request
- Here in Basic--> Parameters tab we need to do change following things:
- HTTP Request is set to POST method
- Ensure ‘Use multipart/form-data’ checkbox is checked
- Input other fields as asked
- Basic--> Files Upload
- File Path: Make sure you give the full file path, including the file name. You can dump all images in a single folder and create any variable e.g. ${filepath}. Call this variable from CSV file where actual path is mention.
Path: apache-jmeter-5.0\bin\Images\kishore.jpg
- Parameter Name: This must be the same as the ‘name’ attribute as it appears in the page source.
- MIME Type: MIME stands for ‘Multipurpose Internet Mail Extensions’. For any kind of Image as per the image file extension, we can use
- image/gif
- image/png
- image/jpeg
- image/bmp
- image/webp
- image/vnd.microsoft.icon
Using the above mentioned steps you should be able to upload images using JMeter. Let me know your queries in the comments below.