JMeter Learning -037-jmeter Debugging Tools four-beanshell+jmeter.log

Source: Internet
Author: User
Tags vars

The previous three articles describe the script debugging instances of HTTP Mirror Server , debug Postprocessor , and debug Samper . This article mainly describes the fourth debugging method, through the BeanShell script combined with Jmeter.log to view the response variables and other information.

BeanShell script Access variables are mainly accessed through vars and props, the main methods are as follows:

      • Vars.get (variable name): Gets the value corresponding to the defined variable, including the BeanShell script generation variable;
      • Vars.put (variable name, variable value): Generates a new variable or modifies an existing variable;
      • Props.get (variable name): Gets the corresponding value of the variable defined in the Jmeter.properties;

Gossip Few, straight up (to be updated pictures ...) Please expect).

The script structure diagram looks like this:

The script "BeanShell Sampler-036 037 Ago" is shown below (knocking on your own, useful for learning ^_^):

The "BeanShell PostProcessor-037 sample thread inside" script looks like this:

The "BeanShell Sampler-037" script looks like this:

The "Debug Sampler Configuration" is shown below (for easy subsequent comparison of props output):

Execute script to view execution results (Jmeter.log):

The "(037 Sample line range) generates the value of the variable" script output is as follows:

The output of "BeanShell postprocessor (037 Sample line Range)" is as follows:

"BeanShell Sampler (after JMeter post 037)" Output is as follows:

The "Debug Sampler" section (jmeter.properties) output is as follows:

All in all, it is visible:

1, BeanShell script can access the script before all the system has defined variables, undefined output is null;

2. BeanShell script can generate new definition variables by vars.put (variable name, variable value) method;

3, BeanShell script parameters are grouped by the space bar as a list, through the bsh.args[index] to access;

4. The BeanShell script can access variables that exist in the jmeterproperties, that is, variables defined in jmeter.properties. You can define the variables to achieve the corresponding purpose, related instances see jmeter Learning -029-jmeter configuration file Propertie configuration item read and application instance ;

5, BeanShell script can be directly referenced to read (recommended) or Parameter form access;

6. When the BeanShell script parameter variable does not exist, the reference method is treated as a string.

Related articles Link:

JMeter Learning -036-jmeter Debug Tool three---debug Sampler

JMeter Learning -035-jmeter Debugging tool two---debug postprocessor

JMeter learn one of the -034-jmeter Debugging tools---HTTP Mirror Server

Related Reference Links:

Http://jmeter.apache.org/usermanual/component_reference.html#BeanShell_Sampler

Http://jmeter.apache.org/usermanual/component_reference.html#BeanShell_PreProcessor

Http://jmeter.apache.org/usermanual/component_reference.html#BeanShell_PostProcessor

http://www.beanshell.org/docs.html

At this point, This article successfully concluded, I hope this article can give beginners JMeter you a reference.

Finally, very grateful to the pro-stop, I hope this article can be pro helpful. Warmly welcome the kiss to discuss together and progress together. Thank you so much! ^_^

JMeter Learning -037-jmeter Debugging Tools four-beanshell+jmeter.log

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.