ATrubka
ATrubka

Reputation: 4004

Accessing JMeter HTTP Request Defaults values

I'm using HTTP Request Defaults to set host and port for a set of requests. I'd like to access the same host value for cookie domain. Is there a way to refer to that particular variable?

Something like this maybe?

${DEFAULT_HOST}

Upvotes: 3

Views: 1990

Answers (2)

andrew lorien
andrew lorien

Reputation: 2678

And for extra credit...

Add a User Defined Variables element to the beginning of the test, so you can pass arguments from the commandline. In my tests, i have

name=HOST
value=${__P(host,test.mysite.com)}

Then you can use ${HOST} for HTTP and cookie defaults (and anything else), and run your test from the commandline like

jmeter -n -t mysite_loadTest.jmx -Jhost=www.mysite.com

Upvotes: 2

vins
vins

Reputation: 15370

No. There are no such default variables to access the HTTP Request Default Values.

But - you can easily achieve this using User Defined Variables.

Just create a variable DEFAULT_HOST=www.google.com

Then update the server name of the HTTP Request Defaults to ${DEFAULT_HOST}

You can also access the hostname everywhere in your test by using ${DEFAULT_HOST}.

Upvotes: 7

Related Questions