How to associate using BeanShell with JMeter

Source: Internet
Author: User

Most of the information is captured by the response information, such as session or hidden, etc.

To use the association in JMeter, the following 2 steps are divided:

Step 1. Add a regular expression to the sampler request, get information, add > Post processor > Regular expression extractor;

1.1 Most of us need to intercept some of the information, by looking at the source code, find the code we need, and then pass the regular processing, here's an example:

function is to extract the values from the Usersession

1.2 Sometimes we need to extract all the response information, and we can use the following:

Step2. Add postprocessers, select BeanShell Postprocessor, and proceed further

In BeanShell we can use Java code to process the contents of the regular extract, the general step is to receive the value of the regular expression extraction, if the value needs to be used as a parameter after sampler, we also want to save it as a variable, easy to call later.

Continue with the usersession in the first example to illustrate:

Since Post requires a session in the login URL, I save it as a variable session, the following is the call session value of the login URL

How to associate using BeanShell with JMeter

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.