I have one random variable and one variable which I read from page. How can I subtract or multiply that two variables and where or in which component in JMeter.
Functions can be used for many different operations, including: inputting information from a file, performing math calculations and value generation, processing strings, evaluating JMeter variables, working with JMeter properties and executing scripts like Javascript or BeanShell script.
Syntax of a function in JMeter: Here "__functionName" matches the name of a function and Parentheses surround the parameters sent to the function. If a function parameter contains a comma then be sure to escape this with "\", otherwise JMeter will treat it as a parameter delimiter.
You can simplify your JMeter test plan by using functions to get parameters like the timestamp or thread name, perform complex calculations, add BeanShell or Javascript code, or read from data files without having to code from scratch.
JMeter thread variables will have not been fully set up when the functions are processed, so variable names passed as parameters will not be set up and variable references will not work. Hence, split() and regex() and the variable evaluation functions will not work.
Check out the functions page for Jmeter. It has tons of cool math tools that you can plug anywhere in your script.
You'll most likely end up doing a jexl command, which would look something like this: ${__jexl2(${var1}-${var2})}
The above did not work for me. How ever i was able to resolve my problem with :
${__jexl(vars.get("YOUR_VARIABLE")+1)}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With