Using JMeter for HTTP interface testing

Source: Internet
Author: User

These days to learn the use of JMeter for HTTP interface testing, which is the basis for performance testing after the installation run, please search by yourself,: Http://jmeter.apache.org/download_ jmeter.cgi here only the process first takes one of the simplest music list requests as an example http://www.xxx.com/service/audio/recommend?sn=sssssssnnnnnnn&ts= 1431485908047&sign=3cc9b856b1ba7edfd4f845e4&audio_type=6&size=5 can run directly in the browser, returning the list of 5 songs 1. Open JMeter, right click ' Test plan '-threads-thread group, creating a thread group

2. Right-click Thread Group-add-Configure symbol-http request default value
The 3.HTTP request default is to set a default value for each HTTP request below, that is, you set it here once, and then each HTTP request can be reused with some settings. I only fill in the domain name, the others use the default value
4. Right-click Thread Group-Add-sampler-http request, add a specific HTTP request
5. In the HTTP request path, except the primary domain name is copied to here. Because this is just a simple query interface, the method chooses get 6. Right-click the HTTP request-add-assert-response assertion to determine if the return value is expected
7. In the response assertion, everything is done by default. When the interface runs successfully, it will return the information of Status Code 2000 and successful, and you can fill in any one of them. Here, the first half of the return value is copied all the way to the maximum extent possible without errors. If your return value is simple, you can select ' Match ' in the ' pattern matching rule ' and copy the return value to the following, which is exactly the relationship. I am here to choose the ' Substring ' that contains the relationship. If you select the next ' No ' check box, the meaning is right and wrong.
8. Then right-click the thread group-add-listener-View the results tree, where all the execution results are displayed
9. Click the Green Triangle Execution button on the toolbar, click ' View result tree ' after execution, click the corresponding HTTP request, and you can see the jmeter request and the result of the response received.


For an interface that needs to append JSON data when sending a request, the operation requires only 2 more places in addition to the above steps 1. Right-click the HTTP request-Add-config component-http header Manager, and click the Add button below to fill in: Content-type and application/ Json2. In the HTTP request, in addition to the completion of the path, in the "Bodydata" below the JSON will be sent to paste in, the method selected as ' POST '

Using JMeter for HTTP interface testing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.