How to upload image through JMeter?

て烟熏妆下的殇ゞ 提交于 2019-12-11 21:49:29

问题


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:

  1. Select "POST" method from drop-down.
  2. Check "Use multipart/form-data for POST" box
  3. 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.

  1. 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

  2. Then, add a CSV Data Set Config element most preferably to the top of the script

  3. 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.

  1. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!