Jmeter Beanshell Post Processor

1. Beanshell post processor

Add path: request--post-processor--BeanShell post-processor

Role: output the response to the log

Click the yellow exclamation mark in the upper right corner of jmeter to see the output effect. You can also view it in the log file in the bin folder of jmeter.

1. Commonly used variables:

Actually refer to the local variable of the Jmeter thread, connect Jmeter and beanshell,
//Get the variable value, if it does not exist, return null
vars.get(String key)
//Store the value to the variable key
vars.put(Stringkey,String value)

2. Log information operation:

log.info(""), brackets place the required variables

3. Obtain the response of the previous sample:

//Get the returned sampler result information
prev.getResponseDataAsString()
//Get the returned sampler status code
prev.getResponseCode()

4. Save and retrieve objects

Save the object
vars.putObject("object name", Object);
take out the object
vars.getObject("OBJECT_NAME");

question:

The jemter beanshell post processor cannot print the desired information

Solution: The semicolon is missing after the code log.info, and the writing method is not standardized.

Finally: The complete software testing video tutorial below has been organized and uploaded, and friends who need it can get it by themselves [Guaranteed 100% free]

Software Testing Interview Documentation

We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Ali, Tencent, and Byte, and some Byte bosses have given authoritative answers. Finish this set The interview materials believe that everyone can find a satisfactory job.

Guess you like

Origin blog.csdn.net/m0_67696270/article/details/131926883