You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Janine DeBeradinis <jd...@higherone.com> on 2011/05/26 21:11:29 UTC

Setting a default value for a variable

Hello -

I was wondering if there was some way to set a default value on a variable.  For example:

I have variable A for our database URL.
I have script A which connect to the database using variable A.
I have script B which calls script A to connect to the database.
I would like to either set variable A in script B (so it gets used in A) OR have script A use a default variable (if one is not 'passed in') from script B.  Example:

Is this possible?

Thanks in advance.

Janine

Re: Setting a default value for a variable

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
I'd say you should be using properties for such use cases - with the
advantage that you can even pass them from the command line (unless
different threads should connect to different db which i doubt)

You can specify defaults with the function call for the proeprty-
http://jakarta.apache.org/jmeter/usermanual/functions.html#__property

see here for an example for passing it from command line
http://theworkaholic.blogspot.com/2009/06/testing-multiple-environments-with.html



regards
deepak

On Thu, May 26, 2011 at 12:11 PM, Janine DeBeradinis <
jdeberadinis@higherone.com> wrote:

> Hello -
>
> I was wondering if there was some way to set a default value on a variable.
>  For example:
>
> I have variable A for our database URL.
> I have script A which connect to the database using variable A.
> I have script B which calls script A to connect to the database.
> I would like to either set variable A in script B (so it gets used in A) OR
> have script A use a default variable (if one is not 'passed in') from script
> B.  Example:
>
> Is this possible?
>
> Thanks in advance.
>
> Janine
>