jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: How to control variable substitution in JMeter?
Date Fri, 14 Mar 2014 12:47:41 GMT
On 14 March 2014 12:09,  <Keith.Cassell@engilitycorp.com> wrote:
> Sebb,
>
> I've been arguing with myself about what the proper behavior of the variable substitution
feature should be, and I think I am now agreeing with you and Shmuel.
>
> I think my problem is mostly a matter of variable scoping, that is, variables should
generally be defined such that they are in scope only where they are needed.  In our naive
implementation, we had too many variables at a global scope.

You could still keep the global scope, but split the variables into
mulitple UDVs.
Temporarily disable the UDVs that you don't want to be considered for
use as replacements during recording.

> There is still the problem of substituting the correct variable into the correct place
in the recorded text; however, I can't think of a simple, effective algorithm that can determine
how to do so.  The regex matching isn't ideal, but it does help for the majority of simple
cases.

Selecting Regex Matching automatically wraps the match string with \b
so that it will only match on word boundaries.
This should help reduce unwanted matches.

> Thanks to you and Shmuel for your help!
>
>> -----Original Message-----
>> From: sebb [mailto:sebbaz@gmail.com]
>> Sent: Thursday, March 13, 2014 2:44 PM
>> To: JMeter Users List
>> Subject: Re: How to control variable substitution in JMeter?
>>
>> On 12 March 2014 16:03, Shmuel Krakower <shmulikk@gmail.com> wrote:
>> > Why making this complex? Just have a dedicated UDV element for such
>> > correlation/replacement, while during recordings, disable the others
>> > you don't wanna use.
>>
>> Good advice.
>>
>> You can have multiple UDV elements.
>> Disable the ones that don't apply to recording.
>>
>> Also, by using the Regex Matching option you can force the matching to
>> use word-boundaries and even use REs to control the matching.
>> This is all described here:
>>
>> http://jmeter.apache.org/usermanual/component_reference.html#HTTP%28S%2
>> 9_Test_Script_Recorder
>>
>> > Shmuel Krakower.
>> > www.Beatsoo.org - re-use your jmeter scripts for application
>> > performance monitoring from worldwide locations for free.
>> >
>> >
>> > On Tue, Mar 11, 2014 at 4:15 PM, Robin D. Wilson <rwilson2@gmail.com>
>> wrote:
>> >
>> >> I've noticed this too. Sounds like a feature request.
>> >>
>> >> Basically, some way to designate which variables can be used for
>> >> substitution when using the recording controller. Perhaps just a
>> >> list.
>> >>
>> >> --
>> >> Robin D. Wilson
>> >> Sr. Director of Web Development
>> >> KingsIsle Entertainment, Inc.
>> >> VOICE: 512-777-1861
>> >> http://www.kingsisle.com
>> >>
>> >> -----Original Message-----
>> >> From: Keith.Cassell@engilitycorp.com [mailto:
>> >> Keith.Cassell@engilitycorp.com]
>> >> Sent: Tuesday, March 11, 2014 9:09 AM
>> >> To: user@jmeter.apache.org
>> >> Subject: How to control variable substitution in JMeter?
>> >>
>> >> I have some user defined variables:
>> >>
>> >> SERVER_NAME          myhost.com
>> >> THE_HTTP_PROTOCOL    HTTP
>> >> USER_COUNT           1
>> >> LOOP_COUNT           2
>> >>
>> >> Then, I use a Recording Controller to capture my browser actions.
>> >> Unfortunately,
>> >> JMeter does more variable substitution than I'd like it to. For
>> >> example, it substitutes ${LOOP_COUNT} into a web site name that
>> >> contains "2", e.g., "/host${LOOP_COUNT}/somePage". My favorite
>> >> example of over-zealous variable substitution is my
>> ${THE_${THE_HTTP_PROTOCOL}_PROTOCOL} Header Manager.
>> >>
>> >> Is it possible to make the recording more selective about what
>> >> variables can be used for substitution? For example, of the
>> variables
>> >> I've listed, I'd really only like SERVER_NAME to be substituted in.
>> >>
>> >> I'm using JMeter 2.11.
>> >>
>
>
> ---------------------------------------------------------------------
> 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