Bug
This article describes the HTTP interface Automation test for Jmeter tools!
For versatility, take the website as a practical example!
Essential Skills: HTTP interface Basics, grasping the package, this article does not do a detailed introduction, will not be the first Baidu to fill!
First, we capture the packet that knows about the login:
Let's grab it. Get
The corresponding script for Jmeter is as follows:
Get the Discovery column script:
Use the regular expression extractor to extract the contents of the column (what? No regular expression? Find Baidu)
Using a foreach controller to merge extraction results into a single string
Printing results:
Operation Result:
There are a few things to keep in mind when testing HTTP interfaces:
- Cookie processing, normal process, can be operated with the HTTP Cookie Manager manager!
- Special process, if you need a custom cookie, can be processed by adding a cookie field to the HTTP header manager!
- Content-type is very important, if the call interface error, to troubleshoot other cases without problems, nine out of ten is the Content-type format is not the result!
- In the performance test, the HTTP interface time-out must set a default value, or in the JMeter distributed testing, the remote server side often can not shut down, need to manually restart, at that time to write a remote restart JMeter server software, embarrassing!
- With JMeter for interface Automation testing, you can use BeanShell to process data, business rule validation, and use JDBC requests and regular expressions to extract database data and Web page data for automated process and data reconciliation!
- More advanced methods, you can put JMeter on the server, and then make calls through Jenkins, you can also write some file plug-ins (Excel), generate comparison results!
Sample script: Http://files.cnblogs.com/files/artoftest/3.zip
Next we introduce the combination of HTTP request, BeanShell, JDBC request, regular expression extractor, to achieve automated data flow and data reconciliation, interested friends can pay attention to, thank you!
"Three" JMeter Interface Automation Test series of HTTP interface automation actual combat