You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Mike Lee <ml...@yahoo.com> on 2008/12/23 20:39:46 UTC
Using variables
If I want to have a variable that I replace in my script how do I do that? I specifically want one I can pass in through the command line BUT ALSO has a default. For example, let's say I want to load a web page but the path to that page may be different depending upon where the test is run. I would like to do;
http://{$SomeDomainAndPath}/ThisIsTheFile.html
I could do -DSomeDomainAndPath=foo.com right?
Is this the right syntax?
If I want to have a default value for the 'SomeDomainAndPath' above what element would I add at the beginning of the test?
Thanks,
Mike
RE: Using variables
Posted by Steve Kapinos <St...@tandberg.com>.
If its a value you want to use that is not thread specific, what you are looking for is a property.
You can assign a default value when you call the property using the __P function. There is an arguement that will be used if the property is not already defined. http://jakarta.apache.org/jmeter/usermanual/functions.html#__P
You pass a value into jmeter for the property using -Jpropertyname=value
These blog posts should help you.
http://coreplex.blogspot.com/search/label/jmeter
-Steve
-----Original Message-----
From: Mike Lee [mailto:mleejrspam@yahoo.com]
Sent: Tue 12/23/2008 2:39 PM
To: JMeter Users List
Subject: Using variables
If I want to have a variable that I replace in my script how do I do that? I specifically want one I can pass in through the command line BUT ALSO has a default. For example, let's say I want to load a web page but the path to that page may be different depending upon where the test is run. I would like to do;
http://{$SomeDomainAndPath}/ThisIsTheFile.html
I could do -DSomeDomainAndPath=foo.com right?
Is this the right syntax?
If I want to have a default value for the 'SomeDomainAndPath' above what element would I add at the beginning of the test?
Thanks,
Mike