JMeter Common script Development BeanShell Sampler

Source: Internet
Author: User
Tags vars

BeanShell Sampler BeanShell Introduction:is a scripting language that conforms fully to the Java syntax specification and has its own syntax and methods; it is a loosely typed scripting language that executes standard Java statements and expressions, and it also includes script commands and syntax Jmeter What are the BeanShell :

Timer: BeanShell Timer

Front Processor: BeanShell preprocessor

Post Processor: BeanShell postprocessor

Sampler: BeanShell Sampler

Assertion: BeanShell Assertion

Listener: BeanShell Listener

Action variables: VARs with built-in objects Access to variables

Vars.get ("Phoneno") gets the value of the variable from the JMeter

Vars.put ("Key", "value") data stored in the JMeter variable

BeanShell Sampler Script Writing

In the test plan, add a variable User=wang

In the thread group, add a variable test=ddd

Debug Sampler-1 and Debug Sampler-2 are used to compare the results before and after BeanShell processing, and the script

Run results

referencing external Java file

Source ("Java file path");

For example: Source ("C:\\users\\administrator\\desktop\\test.java");

referencing external class file

Addclasspath ("path"), and then import the package and class

introducing an external jar Package

Place the jar package under the JMeter installation directory \ Apache-jmeter-3.1\lib\ext, and then test the plan to the right of the bottom of the bread directly add the reference jar package,

Finally, import the jar package in the script

BeanShell sampler-- Incoming parameter Transfer

Define three variables: a,b,c, then enter at parameter: ${a} ${b} ${c}, with spaces in the middle,

Run the results,

JMeter Common script Development BeanShell Sampler

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.