File Upload
Interface documentation as follows:
Packet capture interface information
Add sampler JMeter HTTP requests, set as shown:
File name: local file path can be relative or absolute path
Parameter name: the name of the corresponding parameter in interface documentation, that capture information in the "name"
MIME Type: data type corresponds to the interface document, or capture information Content-Type (figure above fill file or image / jpeg can)
document dowload
1) add the HTTP request the sampler, the interface to fill in the parameter information
2) After the addition BeanShell-processor, as follows:
Import the java.io; byte [] Result = prev.getResponseData (); // Get request return result String path = "C: \\ ADMIN the Users \\ \\ \\ filedownload.xlsx Desktop"; // file saved path, "\" needs to be escaped File File = new new File (path); FileOutputStream OUT = new new FileOutputStream (File); out.write (the Result); out.close ();
3) Run the script, the downloaded file will appear on your desktop