jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Ide <flyingrhenqu...@gmail.com>
Subject Re: Calculations in JMeter
Date Thu, 07 Jul 2011 14:10:37 GMT
I'm typically wary of such scripts. Why not use a BSF sampler with Groovy
and try:

long cti = Long.parseLong(vars.get("cti"));
long cpi = Long.parseLong(vars.get("cpi"));
long eshortage = Long.parseLong(vars.get("eshortage"));
vars.put("pitia", Long.toString(cti + cpi + eshortage / 60));

There's still potentially things that could go wrong here. For example, if
the variables aren't defined then you'll be trying to parseLong on a null,
which will throw an exception. You can add as much checking to it as you
feel is necessary, though. You can also use the SampleResult in a BSF
sampler to write to either the results or to the sampler label.

-- 
Bruce Ide
FlyingRhenquest@gmail.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message