Jmeter 初识三 —— File upload by Jmeter

最近开始测试的接口中设计到了文件的上传和下载。

这版文章就文件上传下载的几种方式进行简略说明。

1. File upload by Web.

  Configure the HTTP Request Sampler with the following detail in order to perform the file upload action-

  • Server Name and Path parameters will be name of the server and its Path for the upload functionality
  • File upload in JMeter will be a HTTP Post request. So, we would be required to select POST Method in HTTP Request sampler.
  • Uploading file to server requires building a multipart/form-data request. For this we will check multipart/form-data for POST checkbox in HTTP Request sampler.

关于 MIME Type 请参考: 

https://www.lifewire.com/file-extensions-and-mime-types-3469109

https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types

这里我遇到了一个问题,如下:

错误点在于,我在 Request Head Manager那里设置了content-type : application/json . 但是此处只是上传file ,不包括具体的内容。 就导致设置了两部分的设置,删除之后就可以了。

执行,upload成功。

2. File upload by FTP

FTP: 

猜你喜欢

转载自blog.csdn.net/gys666/article/details/80520197