Jmeter upload file interface test

Jmeter upload file interface test

Everyone must have done interface testing , but the interface for uploading files may be at a loss. Actually, that's still the case~

1. Interface business

On the premise that the interface document is missing, then start playing with packet capture~ Fiddler or F12 are fine.

The function implemented by our interface this time is to upload user avatars.insert image description here

The screenshot of F12 packet capture is as follows: (the key points related to the interface are circled)insert image description here
insert image description here
insert image description here

Here, pay special attention to the MIME type and upload file interface. If the MIME type is sent incorrectly, the interface cannot be adjusted.

Two, jmeter debugging

1. Thread group

For debugging of a single interface, the thread group 1-1-1 is enoughinsert image description here

2. Configuration components

Add an asynchronous request header (synchronous, asynchronous stupidly unclear. ┭┮﹏┭┮)insert image description here

Upload file interface, requires login authentication, add Cookie Manager to maintain identity status insert image description here
Add HTTP request default value, convenient for subsequent debugging~insert image description here

3. Debug login interface insert image description here
4. Debug upload file interface

Upload the avatar interface, because the Content-Type captured by our packet capture is: multipart/form-data, so we check "Use mulipart/form-data for POST". insert image description here
The form-data form sends a total of 2 parameters.

The first parameter, the key is name, the value is 123.png insert image description here
The second parameter, the key is file, the value is 123.png, plus the MIME type.

insert image description here

The final result, the upload is successful

insert image description here


              [The following is the most complete software test engineer learning knowledge architecture system diagram in 2023 that I compiled]


1. From entry to mastery of Python programming

2. Interface automation project actual combat

3. Actual Combat of Web Automation Project


4. Actual Combat of App Automation Project

5. Resume of first-tier manufacturers


6. Test and develop DevOps system

7. Commonly used automated testing tools


Eight, JMeter performance test

9. Summary (little surprise at the end)

life is long so add oil. Every effort will not be let down, as long as you persevere, there will be rewards in the end. Cherish your time and pursue your dreams. Don't forget the original intention, forge ahead. Your future is in your hands!

Life is short, time is precious, we cannot predict what will happen in the future, but we can grasp the present moment. Cherish every day and work hard to make yourself stronger and better. Firm belief, persistent pursuit, success will eventually belong to you!

Only by constantly challenging yourself can you constantly surpass yourself. Persist in pursuing your dreams and move forward bravely, and you will find that the process of struggle is so beautiful and worthwhile. Believe in yourself, you can do it!

Guess you like

Origin blog.csdn.net/NHB456789/article/details/131659205