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.
Asked
Active
Viewed 2.1k times
2 Answers
45
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 Hungry Dictator
- 3,444
- 5
- 37
- 53

BlackGaff
- 7,579
- 1
- 38
- 45
-
Thanks! I needed ${perpage} variable defined in JMeter and ${__jexl(vars.get('perpage')-1)} worked for me! – test30 Nov 26 '13 at 02:17
-
This worked for me in Throughput Shaping Timer, while other methods (beanshell, javascript etc) were not working. Thanks. – TestingWithArif Mar 22 '16 at 12:35
-
I am trying to perform division operation, but it's not working because ${var1} returns a String. Is there any way to do so, I can not use any pre processors as my case is specific. – DanzerZoneJS Mar 29 '20 at 20:36
3
The above did not work for me. How ever i was able to resolve my problem with :
${__jexl(vars.get("YOUR_VARIABLE")+1)}

flavio.donze
- 7,432
- 9
- 58
- 91

rinkush sharda
- 351
- 3
- 3