jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kyle McAbee" <>
Subject RE: Can BeanShell execute String.substring or StringBuffer.insert methods ?
Date Wed, 09 Feb 2005 21:53:59 GMT
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,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message