step:
- Open the Fiddler packet capture tool
- Upload files in the platform to be tested
- Find the upload-related data in the package captured by fiddler, and observe the request data
- Create a new HTTP request in jmeter for file upload, click Run to view the return value
Remarks:
- The above is performed when the platform has been logged in (for login details, see Jmeter Web platform interface test script 1) Jmeter Web platform interface test script 1
- The path of the file to be uploaded is best to be typed by yourself. Right-click to copy and paste the path in the properties, and it will report Java-File not found exception.
Fiddler captures packet data:
Create an HTTP request and configure parameters in jmeter:
Operation result:
Check whether the upload is really successful in the platform system:
Note: In Jmeter, I built a Beanshell post-processing file
This file (paste the code in the script: prev.setDataEncoding("UTF-8")
), the purpose is to allow the Chinese in the returned body to be displayed normally. After uploading the file name, the garbled code shown here is Baidu. It is a vulnerability of Jmeter5.3 version, which needs to be repaired by another file. Here I don't want to make progress. If you think it is necessary to fix it, you can search it on Baidu by yourself.