IV: Building an advanced Web test plan

Source: Internet
Author: User

Send a request with header

Reference: Http://jmeter.apache.org/usermanual/build-adv-web-test-plan.html#header_manager

JMeter inside the header that manages the sent request uses the HTTP header manager. Use it to add or override various header properties, such as "User-agent", "Pragma", "Referer", and so on.

Add HTTP Header Manager method: add–> Config element–> HTTP header Manager

Can be placed directly into the thread group, so that it acts on all requests within the set of threads. It can also be placed under a request, which only acts on the current request.

After adding the test plan, you can see that the request sent has two connection, one is automatically added, and the other is the request header that was added via HTTP header manager.

Send a request with a cookie

Reference: Http://jmeter.apache.org/usermanual/build-web-test-plan.html#adding_cookie_support

Manage cookies using Cookie Manager.

The cookie Manager element automatically stores and sends cookies like a browser. If the HTTP request is included in the response, Cookie,cookie Manager will automatically store the cookie and use the value of these cookies in future access to the site. Each user has its own independent cookie store, so it does not interfere with each other. This automatically stored cookie is not visible in the cookie Manager, but can be seen in the View Result tree.

The cookie value can also be stored in the jmeter thread variable. If you want to save the cookie as a variable, you need to define the attribute "Cookiemanager.save.cookies=true" in Jmeter.properties. This assumes that the name of a cookie is TEST, and we can use ${cookie_test} to refer to it, and jmeter by default adds a prefix cookie in front of the cookie variable, or you can use the attribute " cookiemanager.name.prefix= "from the definition prefix.

If you want to add some cookies manually, you can add them directly inside the user-defined-cookies. This allows these cookies to be shared by all threads.

After you add a cookie, you can see the cookie sent in the request of View Results tree.

It is important to note that JMeter does not advocate the use of multiple cookie Manager. If more than one cookie Manager is used, JMeter cannot determine which one will be used.

IV: Building an advanced Web test plan

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.