I did it eventually with a BeanShell function - and I've remembered why
I have a love/hate relationship with Jmeter in the past - it's great
when it works, but when something breaks, it has some of the worst error
messages in the world...
I'm sure there are cleaner ways to do this, but what I did was:
- Create a beanshell init file (for a single point for global bean shell
functions)
- Add a function to this file:
fixAmps(s) {
return new String(s).replaceAll("&","&");
}
- In my request, assuming the regexp containing my parameters is FOOBAR,
set the Path to:
/myquery.do${__BeanShell(fixAmps("${FOOBAR}"))}
I tried this first in Javascript, but got so many meaningless error
messages I gave up and tried BeanShell, which I could at least put
neatly in a stand-alone file.
- Korny
sebb wrote:
On 31/03/06, Kornelis Sietsma <[EMAIL PROTECTED]> wrote:
Hi - I'm having some pain trying to do something that should be simple.
I have a page with a number of URLs in it, of the form:
a
href="/myquery.do;jsessionid=12345?param1=12345&param2=abcde&param3=foo"
I'm trying to simply follow one of these URLs in a new http request -
but while I can grab the whole request into a regexp fairly easily, as
soon as I substitute it into a HTTP Request (by putting
"${MY_REGEXP_g1}" in the "Path" field) I have real pain - the escaped
form of the ampersands ("&" is sent to the tested application, so
it sees the parameters as "param1", "amp;param2", "amp;param3" and so on.
Does anyone have any suggestions for getting around this? Currently
I've changed my regexp to extract each param as a separate group, but
it's slow to build an expression this way, and a bit fragile if the
application changes it's parameter order or the like.
You could use a javascript or beanshell function to replace the &
with & in the output variable - assuming you want to replace them all.
You might be able to do this in the RegexExtractor itself, by wrapping
the $1$ in a function call.
Or you can do the same on the sampler.
Or you could be really sneaky and use the BeanShell Assertion to
change the value of the variable. This relies on the fact that
Assertions are called after the Post-Processors, so the output
variable from the Reg Ext will be available for use.
S.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Kornelis Sietsma e-mail: korny at my surname dot com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]