You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Kyle Schmitt <ky...@gmail.com> on 2007/01/11 19:47:20 UTC
Variable Substitution for cookies
I know that if I have a variable, say password=ncc1701, and I record a
test, all instances of ncc1701 will be replaced with ${password}.
Now I'm using a regular expression to pull out certain variables (like
viewstate) from each page in my test, and passing it back on almost
every page.
The problem is, since the viewstate always changes, jmeter won't
automatically substitute ${viewstate} for viewstates value in the Get
or Post parameters. Right now I've got to go through and manually
remove&paste ${viewstate} in the recordings, or use sed or another
regex editor to do the trick.
There MUST be a better way of doing this, so....Is there one built
into JMeter, or is this something that would require an edit of JMeter
itself.
If it's going to require an edit, is there a new-jmeter programmers guide?
Thanks,
Kyle
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: Variable Substitution for cookies
Posted by sebb <se...@gmail.com>.
On 11/01/07, sebb <se...@gmail.com> wrote:
> On 11/01/07, Kyle Schmitt <ky...@gmail.com> wrote:
> > I know that if I have a variable, say password=ncc1701, and I record a
> > test, all instances of ncc1701 will be replaced with ${password}.
> >
> > Now I'm using a regular expression to pull out certain variables (like
> > viewstate) from each page in my test, and passing it back on almost
> > every page.
> >
> > The problem is, since the viewstate always changes, jmeter won't
> > automatically substitute ${viewstate} for viewstates value in the Get
> > or Post parameters. Right now I've got to go through and manually
> > remove&paste ${viewstate} in the recordings, or use sed or another
> > regex editor to do the trick.
>
> Are you referring to the Proxy Recorder here?
>
> > There MUST be a better way of doing this, so....Is there one built
> > into JMeter, or is this something that would require an edit of JMeter
> > itself.
>
> The Proxy Recorder only replaces fixed strings at present.
>
> But I suppose it could be updated to use REs instead, and to replace
> only part of the match.
Actually, I forgot, it does support REs - however, Jakarta ORO does
not support lookbehind, which makes it impossible (in general) to
create a suitable regex to match only the viewstate value.
But you might be lucky - the viewstate values may be such that they
cannot appear elsewhere, or there may be some trailing context
(lookahead) that you can use to restrict matches to viewstate values
only.
> I.e. one wants to replace
>
> _viewstate=xyz
>
> with
>
> _viewstate=${var}
>
> not
>
> ${var}
>
> > If it's going to require an edit, is there a new-jmeter programmers guide?
> >
>
> Check the Wiki and JMeter mail archives ...
>
It ought to be possible to use the Java regex engine - which has look
behind - instead of ORO, at least for the Proxy.
The work seems to be done by ProxyControl.replaceValues(), so it
should just be question of modifiying that to use the different regex
engine...
It may be worth replacing ORO with the Java regex engine entirely at
some point - or adding it as an option - but that is some way off...
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: Variable Substitution for cookies
Posted by sebb <se...@gmail.com>.
On 11/01/07, Kyle Schmitt <ky...@gmail.com> wrote:
> I know that if I have a variable, say password=ncc1701, and I record a
> test, all instances of ncc1701 will be replaced with ${password}.
>
> Now I'm using a regular expression to pull out certain variables (like
> viewstate) from each page in my test, and passing it back on almost
> every page.
>
> The problem is, since the viewstate always changes, jmeter won't
> automatically substitute ${viewstate} for viewstates value in the Get
> or Post parameters. Right now I've got to go through and manually
> remove&paste ${viewstate} in the recordings, or use sed or another
> regex editor to do the trick.
Are you referring to the Proxy Recorder here?
> There MUST be a better way of doing this, so....Is there one built
> into JMeter, or is this something that would require an edit of JMeter
> itself.
The Proxy Recorder only replaces fixed strings at present.
But I suppose it could be updated to use REs instead, and to replace
only part of the match.
I.e. one wants to replace
_viewstate=xyz
with
_viewstate=${var}
not
${var}
> If it's going to require an edit, is there a new-jmeter programmers guide?
>
Check the Wiki and JMeter mail archives ...
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org