How to use beanshell-in JMeter performance Test course student works

Source: Internet
Author: User
Tags vars

Xiao Qiang Reviews:

The BeanShell in JMeter is used to save or process data by writing Java code, which requires a certain development foundation. This article is a performance test of Xiao Qiang in the case of the children's shoes with the association as an example to do the sharing, the text is as follows:


The so-called Association, how many number is through the corresponding information to crawl part of the information, as to what the association class has been said no longer repeat. To use correlation in jmeter, divide it into 2 steps:


Step 1. Add a regular expression to the sampler request, get information, add > Post processors>regular expression Extractor;

650) this.width=650; "Src=" https://mmbiz.qlogo.cn/mmbiz/ Icgsknubvvjhp9aibfvl6puiaaalohxbyibhhpqtdxppxoduxlupovlmevfupicnhj5d26islt2bsh4czqxvuwdazjw/0?wx_fmt=png "Style = "Margin:0px;padding:0px;height:auto;" alt= "0?wx_fmt=png"/>
Use regular expressions to match the content you want to associate with.

Step2. Add post processers, select BeanShell Postprocessor, and proceed further.

650) this.width=650; "Src=" https://mmbiz.qlogo.cn/mmbiz/ Icgsknubvvjhp9aibfvl6puiaaalohxbyibhu76zanoyicg9sl4fz0qersafhcicpxo5z7novmxsicamugpuxxqzjm72g/0?wx_fmt=png " Style= "Margin:0px;padding:0px;height:auto;" alt= "0?wx_fmt=png"/>
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.


Here's an example of a project in the classroom: because post needs to be submitted at the login URL, I'm saving it as a variable session, and here is the call session value for the login URL.

650) this.width=650; "Src=" https://mmbiz.qlogo.cn/mmbiz/ Icgsknubvvjhp9aibfvl6puiaaalohxbyibh7wzfuncdc6v5bypiafjxoawndyzooydg1mb7xpjr9jo96xfqxrkibm1a/0?wx_fmt=png " Style= "Margin:0px;padding:0px;height:auto;" alt= "0?wx_fmt=png"/>
The specific BeanShell code is the code below, there are comments, you can see.


Xiao Qiang Reviews:

BeanShell executes standard Java statements and expressions, plus some scripting commands and syntax. Official website:http://www.BeanShell.org/interested to see it yourself.


In addition, you can generally use the Vars.put method to save a value to a variable, by vars.get the value of the corresponding variable out of the other is to see what you specifically need to do.


The use of BeanShell itself is not difficult, most will not be used because there is no code base.


Advertised

Xiao Qiang performance test class enrollment, the top 10 discount 300, consulting application plus qq:2083503238

Jack Bauer python Automation test enrollment, the Top 10 discount, consulting join QQ Group: 519996731 (note is QQ Group)


650) this.width=650; "Src=" https://mmbiz.qlogo.cn/mmbiz/ Icgsknubvvjiavnp6ft9nl9cnn86qm1spg8bfqyxick9g7vfssug5qcmd05k0xld2pu75bgmelgdycbemiciadktrqw/0?wx_fmt=jpeg " Style= "Margin:0px;padding:0px;height:auto;" alt= "0?wx_fmt=jpeg"/>


This article is from the "Xiao Qiang performance test & Product Manager Nest" blog, make sure to keep this source http://xqtesting.blog.51cto.com/4626073/1770748

How to use beanshell-in JMeter performance Test course student works

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.