jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: Updating a User Parameter variable from the Regular Expression Extractor
Date Fri, 07 Sep 2012 00:13:21 GMT
On 6 September 2012 23:46, Cedrick Johnson
<cjohnson@backstopsolutions.com> wrote:
> One more follow up to Oliver's response҆ I banged my head against the wall
> trying to get the while controller to actually exit when a certain
> condition was met based on what we get back from the server (also assigned
> via a regex extractor)..
>
> The while controller's condition needs to be something like this:
> ${__javaScript("${myVar}"=="some text")}
>
> Just trying this for me didn't work: ${myVar}=="some text"

Remember that variable replacement occurs before the string is passed
to the function [1], in this case Javascript.
If myVar == "abcd" then Javascript would see:

abcd=="some text"

whereas what you want to test is

"abcd"=="some text"

That's why the enclosing quotes are needed.

[1] http://jmeter.apache.org/usermanual/functions.html#__javaScript

> Hope this helps,
> CJ
>
> On 9/6/12 5:43 PM, "Oliver Lloyd" <oliver_lloyd@hotmail.com> wrote:
>
>>In short: Yes, this is possible.
>>
>>And yes, the while loop is valid approach. The while statement will check
>>if myVar is set to "some text" and then keep polling until the regex
>>changes the value of myVar to "some other value".
>>
>>
>>On 6 Sep 2012, at 23:02, Robin D. Wilson wrote:
>>
>>> I am having some trouble updating a User Parameter variable from the
>>>Regular Expression Extractor - and I need to know if this can
>>> even be done (before I waste any more time trying to figure out the
>>>problem).
>>>
>>> Scenario:
>>>
>>> User Parameters
>>>      Variable: myVar = true
>>>
>>> HTTP Request (a web page - not important which one)
>>>      Regular Expression Extractor
>>>              Reference Name: myVar (same as the User Parameter variable name
above)
>>>              Regular Expression: stuff here - gets value from page
>>>
>>> Should I be able to update/alter the value of 'myVar' that was set in
>>>the User Parameters using this method?
>>>
>>> If not, is there a way to do this - basically what I want to do is wrap
>>>the HTTP Request with a 'while' loop, and if my variable
>>> name is changed from the default value, end the loop.
>>>
>>> --
>>> Robin D. Wilson
>>> Sr. Director of Web Development
>>> KingsIsle Entertainment, Inc.
>>> VOICE: 512-777-1861
>>> www.KingsIsle.com
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>>> For additional commands, e-mail: user-help@jmeter.apache.org
>>>
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>>For additional commands, e-mail: user-help@jmeter.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Mime
View raw message