Bean Shell Common built-in variables
JMeter has built-in variables in its BeanShell that allow users to interact with JMeter, the main variables and how to use them as follows:
Log: Write information to Jmeber.log file, using method: Log.info ("This is log info!");
CTX: This variable refers to the context of the current thread and is used in the following way: Org.apache.jmeter.threads.JMeterContext.
VARs -(jmetervariables): Manipulate the JMeter variable, which actually refers to the local variable container in the JMeter thread (essentially map), which is a bridge between test cases and BeanShell interaction, common methods:
A) Vars.get (String key): Gets the value of the variable from the JMeter
b) Vars.put (String key,string value): Data is stored in the JMeter variable
More ways to see: org.apache.jmeter.threads.JMeterVariables
Props -(Jmeterproperties-class java.util.Properties): Manipulate the JMeter property, which references the configuration information of JMeter, can get the properties of JMeter, It is used in a similar way to VARs, but it can only be put in a string type value, not an object. Corresponds to Java.util.Properties.
A) Props.get ("START. HMS "); Note: Start.hms is a property name, defined in file jmeter.properties
b) Props.put ("PROP1", "1234");
A) getresponsedataasstring (): Get response information
b) Getresponsecode (): Get Response code
More ways to see: Org.apache.jmeter.samplers.SampleResult
JMeter Bean shell Usage-common built-in variables