You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2014/05/21 15:58:49 UTC
[Bug 56552] New: Add option to disable interpolation in JSR223
https://issues.apache.org/bugzilla/show_bug.cgi?id=56552
Bug ID: 56552
Summary: Add option to disable interpolation in JSR223
Product: JMeter
Version: 2.11
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: Main
Assignee: issues@jmeter.apache.org
Reporter: 1983-01-06@gmx.net
Using a Groovy inline script with a cache key causes a problem. Consider the
following example:
def sessionId = vars.get("sessionId")
def formatted = "${sessionId}_cool";
If the sessionId is regenerated in a preprocessor, only the first interpolation
from JMeter works due to caching. Groovy cannot not interpolate the GString
because it has already been done by JMeter. I'd like to be able to disable
interpolation on cacheable items.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 56552] Add option to disable interpolation in JSR223
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56552
--- Comment #6 from Michael Osipov <19...@gmx.net> ---
Sebb,
can we at least mention that int the pre/post processor docs and other folks
won't be tricked?
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 56552] Add option to disable interpolation in JSR223
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56552
Philippe Mouawad <p....@ubik-ingenierie.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |p.mouawad@ubik-ingenierie.c
| |om
--- Comment #3 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
Created attachment 31658
--> https://issues.apache.org/bugzilla/attachment.cgi?id=31658&action=edit
Test plan showing it works provided interpolated string is not a JMeter
variable
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 56552] Add option to disable interpolation in JSR223
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56552
--- Comment #7 from Sebb <se...@apache.org> ---
(In reply to Michael Osipov from comment #6)
> Sebb,
>
> can we at least mention that int the pre/post processor docs and other folks
> won't be tricked?
Patches welcome ...
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 56552] Add option to disable interpolation in JSR223
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56552
Sebb <se...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #1 from Sebb <se...@apache.org> ---
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.
If this is so, then there are several options:
1) use a file rather than an in-line script
2) use a variable name that is not defined in JMeter, as Jmeter leaves such
references alone
3) escape the $ or the { with backslash
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 56552] Add option to disable interpolation in JSR223
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56552
Michael Osipov <19...@gmx.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
--- Comment #2 from Michael Osipov <19...@gmx.net> ---
(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.
> 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.
> 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.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 56552] Add option to disable interpolation in JSR223
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56552
--- Comment #5 from Sebb <se...@apache.org> ---
(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.
[Bug 56552] Add option to disable interpolation in JSR223
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56552
Philippe Mouawad <p....@ubik-ingenierie.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |WORKSFORME
--- Comment #4 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
As explained by Sebb, provided interpolated string is not a JMeter variable it
works.
If it is a jmeter variable, disabling cache key workarounds this but at the
cost of performance degradation, so changing groovy var name is a reasonable
option.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 56552] Add option to disable interpolation in JSR223
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56552
--- Comment #8 from Michael Osipov <19...@gmx.net> ---
(In reply to Sebb from comment #7)
> (In reply to Michael Osipov from comment #6)
> > Sebb,
> >
> > can we at least mention that int the pre/post processor docs and other folks
> > won't be tricked?
>
> Patches welcome ...
Against this monster?
http://svn.apache.org/viewvc/jmeter/trunk/docs/usermanual/component_reference.html?view=markup
--
You are receiving this mail because:
You are the assignee for the bug.