I've been asked this time to also create a test script for file upload in a JSF application using JMeter. The generated script from blazemeter is as follows:
generated script for input form
The encircled value is the file name. I have noticed that the parameter was not created under "Files Upload" tab, so I have also tried to move the parameter to File Upload tab, using the generated content type in our application logs when uploading as Mime Type in JMeter:
But it has the same result when I first tried the script where the file name parameter was still under "Parameters" tab (file name is null according to localhost application logs):
Application log indicating that file name is null
The UI of the file upload is this. The user clicks browse button, picks a file then the name of the file is displayed in the input field (Import File). The user would then click the Import button to submit the form:
Am I missing a step or doing something incorrectly?
Thank you in advance! Any help would be greatly appreciated.
Your way of building a file upload request might be wrong, if you want to continue manual experiments I would recommend comparing requests which are being sent by JMeter and the real browser using a sniffer tool like Wireshark . Apart from ${VIEWSTATE}
the requests should be exactly the same.
An easier option would be just re-recording the request (you can record only one single request) using HTTP(S) Test Script Recorder .
Prepare JMeter for recording. The easiest way of doing this is using JMeter Templates feature
Prepare your browser for recording, refer your browser documentation in order to set up proxy using localhost
as the proxy host and 8888
as the proxy port, the proxy needs to be set for all protocols with no exclusions . The relevant configuration for Mozilla Firefox (the only free and open source popular browser, moreover it has separate proxy configuration which does not derive from the operating system) would be:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.