Dear JMeter Users and Sebb:

Sebb was correct (thanks, Sebb!). The reason that the String.substring and 
StringBuffer.insert methods were not working was that I wrote the methods with 
arguments that included a comma. (This is what comes of not following my own 
trouble-shooting steps for JMeter functions!)

A JMeter function parameter that contains a comma character must be preceded by 
an escape character (backslash). If the backslash is missing, JMeter treats a 
comma as a delimiter between parameters rather than as part of a parameter. In 
the examples below, all of the Java code is a single parameter of a BeanShell 
function. A BeanShell function can optionally have a second parameter.

                      |<--------- One BeanShell parameter ---------->|
Right:  ${__BeanShell( str = "Password"; return str.substring(0\, 4); )}
Wrong:  ${__BeanShell( str = "Password"; return str.substring(0, 4); )}


I'm not sure what Sebb meant when he wrote of the BeanShell Sampler:

> The text does not need to be quoted in the [BeanShell] Sampler script ...

What text did you mean, Sebb?

Sincerely yours,

Kyle

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to