One, jmeter file upload
Get ready:
1, JMeter, I use 3.3
2, the interface document, determine the interface address, the way of the request, as well as the necessary parameters and the correct return results
JMeter script:
1. Add a thread group, add an HTTP request under the thread group, and view the result tree
2. The HTTP request fills in the protocol, the server name, the request method, and the path
3, because is the upload file, so the parameter must choose "Files Upload" here
File name: Fill in the path and name of the file (if you put the file in the bin directory of JMeter, you can write the filename only)
Parameter name: Fill in the parameter name according to the interface document
MIME type: jmeter3.0 can not write, but 3.3 does not write will be error, as long as the written on the line
To run the script :
Upload the file script is OK, can be said to be easy
Second, jmeter file download
Get ready:
1. Or the JMeter
2. Interface address, I casually find a, my QQ space inside photos, as long as there is a return of the results on the line
JMeter script:
1. Add thread Group, add HTTP request under Thread Group, BeanShell Sampler, view result tree
2.HTTP request, fill in the agreement (do not write or affect), server name, path, request method
3. Because the return value in the HTTP request can only be viewed in the response data, we need to save the return data and use the BeanShell
1 ImportJava.io.*;2 3 byte[] result = Prev.getresponsedata ();//This is the data that gets returned to the request, Prev is the return of the last request4 5String file_name = "C:\\users\\jyd\\desktop\\girl.jpg";//represents the location and file name where the files are stored6 7File File =NewFile (file_name);8 9FileOutputStream out =Newfileoutputstream (file);Ten One out.write (result); A -Out.close ();
To run the script:
The return result of the HTTP request is the one that can see the returned data
It also saves the picture to the desktop
Ok!!!
JMeter File Upload Download