Jmeter interface test picture upload

1. First create an http request under the thread group

2. All the settings related to the uploaded pictures are in the http request

3. The request type inside is changed to post, (I forgot to change it in the picture) The most important lmplementation must be set to java

4. The file name must be the full path of the picture plus the picture name plus suffix

5. Pictures of mime type such as jpg format are filled with image / jpg

use multipart / form-data for POST: use a form of submission form that does not encode data

browser-compatible headers: browser-compatible headers

step:

1. Content-Type: multipart / form-data for http upload attachments; in this article, first fetch the interface request through fiddler, and then simulate the request through jmeter. If there is an interface document, you can skip this step

Enlarged picture of data captured by fiddler

Figure 1

2. We first put the header information in the HTTP information manager

3. Then copy the information of webforms in fiddler to the parameters of jmeter's http request. Note: the name of the parameters only retains the name value of the webforms in fiddler. Compare the following figure with the one in step 1, and check Use multipart / form data and Browser-compatible headers.

4. Put the name of the image to be uploaded "name = img_texture", click files upload and place it under the item

Detailed explanation:

File name: The location where the picture needs to be uploaded is accurate to the picture itself, as in this example: C: \ Users \ Public \ Pictures \ Sample Pictures \ tp_1.jpg

Parameter name: This refers to the parameter that needs to be uploaded in the WebForms in the fiddle capture package, the value of name = '' '', as in this example, name = "img_texture"

MIME type: Select the Content-Type value of the line captured by webforms in fiddler, in this case file

5. The last step is very important, click on the advanced option of the jmeter request and select implementation as java

6. You can see the return value after running

Published 29 original articles · Like1 · Visitor 571

Guess you like

Origin blog.csdn.net/wennie11/article/details/105572189