jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Liang <>
Subject RE: intSum() is broken; code fix available
Date Thu, 12 Dec 2013 01:06:38 GMT
I found the problem and have a fix.

The problem is cause by parsing of the lead space character when intSum() parses the input

bad=${__intSum(${start}, ${counter})}

Notice there is a space character after the , and before $.

The line that failed to parse this properly is line 64.

Here is the fix:

current code with parsing error:
String varName = ((CompoundVariable) values[values.length - 1]).execute();

corrected code which remove any leading and trailing space:
String varName = ((CompoundVariable) values[values.length - 1]).execute().trim();

I've compared my fix to and (which already works).  Looks like whoever
fixed forgot to apply the same to

Implication for other jmeter functions:

Also note that any other jmeter functions that don't properly trim the leading space will
have the same parsing problem.  Perhaps a better place to fix this problem is in CompoundVariable.execute(SampleResult
previousResult, Sampler currentSampler) method.  Fixing things in CompoundVariable.execute()
means all jmeter functions will automatically benefit.  However, I am not familiar enough
with jmeter source code to have confidence that trimming leading and trailing spaces in CompoundVariable.execute()
won't cause other side effects.

James Liang

-----Original Message-----
From: James Liang [] 
Sent: Tuesday, December 10, 2013 4:01 PM
Subject: bug: intSum() is broken

Hi all,

I notice intSum() is broken for version 2.10.  The function longSum() works fine.

To reproduce:

create 4 user paramters as follow:

bad=${__intSum(${start}, ${counter})}
good=${__longSum(${start}, ${counter})}

I've test this inside a loop.  Remember __counter() starts with 1.

On 1st pass

On 2nd pass

The jmeter log shows no errors.  It'd seem intSum() is always returning the first parameter
without doing the sum operation.

James Liang

View raw message