https://issues.apache.org/bugzilla/show_bug.cgi?id=56552

--- Comment #5 from Sebb <[email protected]> ---
(In reply to Michael Osipov from comment #2)
> (In reply to Sebb from comment #1)
> > If I understand correctly, this is nothing to do with caching.
> > 
> > The problem is that both Groovy and JMeter use the same syntax - i.e.
> > ${varname} - to refer to variables. So JMeter replaces ${varname} with the
> > contents of the variable before Groovy sees the script.
> 
> Not exactly, if I understand caching correctly, JMeter processes (filters)
> the script one, passes to Groovy, caches the result and then uses it over
> and over again. So the result is that the JMeter interpolation happens only
> once, at compile/cache time.

However only a fixed script can be cached.

> > If this is so, then there are several options:
> > 
> > 1) use a file rather than an in-line script
> 
> In my case, script are a few lines, I do not to scatter stuff.

It would still work ...

> > 2) use a variable name that is not defined in JMeter, as Jmeter leaves such
> > references alone
> 
> Yes, that is a workaround only.
> 
> > 3) escape the $ or the { with backslash
> 
> How? \$? I haven't found a clear paragraph on the in the functions reference.

Does not appear to be possible to escape the $ or {; sorry.

However, one can define a variable (e.g. on the test plan):

DOLLAR $

and then use the following:

${DOLLAR}{sessionId}

The DOLLAR reference is resolved, but the resulting output is not rescanned by
JMeter, so the result is that ${sessionId} is passed to Groovy (and cached).

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to