Interface Test Jmeter+fiddler Combination
After the use of JMeter in the interface test, the personal feeling jmeter than LoadRunner good, because the interface operation more intuitive, not like LoadRunner in the writing interface request function, need to pay attention to the script format and other problems, The other is JMeter return server response information is relatively clear, only need to master the HTTP principle.
Interface Test Preparation:
1, jmeter environment preparation, download JMeter compressed package, decompression can; Install the JDK configuration environment variable;
2, grasping the Bag tool fiddler;
In the interface test, it is necessary to develop a total of interface related information, such as interface address, parameters, constraints, etc. can also be captured by the packet to obtain information about the interface, commonly used to catch contractor with Firefox browser Firebug, Fiddler, Wireshark and so on.
Firebug is the Firefox browser comes with the tool, simple and practical, can be used as interface test aids, using the following:
Open the Firefox browser to open Firebug, click on the network, and then log on, you can view the login request related information;
Click Post to view the submission of the Post form submission parameters, click Response, you can view the server back to the response information;
Fiddler is the best tool to grab the bag, not one; Use the following method:
Before the interface operation, open Fiddler, and then open the browser to operate the system, the operation is completed, you can view the request parameters in the Fiddler;
Method is: POST
The requested address is:/os/dologin
The request parameter is: Username=admin
password=827ccb0eea8a706c4c34a16891f84e7b
Ckpass=1
After grasping the package, use JMeter to do the interface test:
1. Add thread Group: Open JMeter, right-click Test Plan-Add-threads-thread Group;
2. Add request Default value: Right-click Thread Group-add-Configure symbol-http request default value (optional);
Enter the server IP address and port number;
3. Add HTTP Cookie Manager: Right-click Thread Group-add-config component-http Cookie Manager;
4. Add HTTP Request: Right-click Thread Group-add-sampler-http request;
According to the data in the Fiddler grab packet, fill in the relevant information in JMeter: Method select Post, path fill/os/dologin; add parameters in parameter;
5. Add View result tree: Right-click Thread Group-add-listener-view result tree;
6. Click Start to view the request information and response information in the results tree.
During the test, in order to obtain the results returned by the last server, or to use the server to return the results as input for the next request, we need the regular expression to extract the required return results;
7. Add Regular expression Extractor: Right-click Thread Group-add-post processor-regular expression extractor;
Reference name: Random input, as a variable to save the result; Regular expression: Enter the expression that you want to extract the result from; template, match number, default input.
8. Add Debug Sample: Right-click Thread Group-add-sampler-debug sampler;
The name to: Status=${status},${status} means that the value in the status in the regular expression extractor is displayed;
9, run JMeter, check the regular expression extraction results;
Interface Test Jmeter+fiddler Combination