You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Pablo Llopis <pa...@gmail.com> on 2011/07/12 17:42:42 UTC

Variables in HTTP headers

Hello JMeter Community,

I am trying to do some performance test on an authentication service
deployed at a very small testing OpenStack Swift cluster.
The important details about this is that in order to authenticate a user,
the user needs to supply two HTTP headers (X-Storage-User and
X-Storage-Pass). In return, an auth token is provided through HTTP headers
(X-Auth-Token).
Using HTTP Authorization Manager does not seem an option because I do not
see how I can force it to use those custom http headers.

I can successfully authenticate using a single user by using the HTTP Header
Manager and setting both required headers accordingly. In order to obtain
the resulting auth token, I suspect that I can just use a Regular Expression
Extractor PostProcessor, but I have not verified that yet.

I am having trouble doing authentication as described above when using
dynamic username/password combinations that are saved in a CSV file. It
seems like even if I use a CSV Data Set in order to create the user and
password variables, HTTP Header Manager ignores those variables. Instead, I
am literally seeing ${user} being sent through the wire.
I am not sure if this is due to the fact that HTTP Header Manager is a
Config Element which is only loaded initially. Or maybe HTTP Header Manager
is supposed to handle variables but I am doing something very wrong.
I don't see how I could insert variables into HTTP Headers otherwise, as
HTTP Request does not offer that option.

I am fairly new to JMeter, so its possible that I am missing something
obvious. Any thoughts on the easiest way to accomplish inserting variables
stemming from a CSV file into HTTP Headers? (each thread, being a different
user, would use a different variable).
Maybe this is not possible at all and I will need to write my own
"component", maybe extending HTTP Request? (how straightforward would this
be, if this is the only way?)

I am sorry if this was answered before, but no search results were helpful
:)

Thank you,

Pablo

Re: Variables in HTTP headers

Posted by Pablo Llopis <pa...@gmail.com>.
Thank you, it worked great. My problem was that the CSV file was not being
read correctly. While other JMete files default to the bin/ directory, that
input file defaults to the "root" directory, which got me confused.

Thank you again for your help,

Pablo

On Tue, Jul 12, 2011 at 7:14 PM, Deepak Shetty <sh...@gmail.com> wrote:

> +ThreadGroup
> ++WhileController
> +++Debug Sampler
> +++HTTPRequest
> +++CSVDataSetConfig (user,password)
> ++HTTP Header Manager (${user},${password})
> ++ View Results Tree listener.
> should work. If it doesnt its probably you arent reading the CSV correctly
> (check jmeter.log). You can also add a debug sampler + view results tree
> listener so that you can see what values the variables have
>
>
> >I suspect that I can just use a Regular Expression Extractor
> PostProcessor,
>
> Choose headers in the Response Field to check
>
>
>
> regards
> deepak
>
> On Tue, Jul 12, 2011 at 8:42 AM, Pablo Llopis <pablo.llopis@gmail.com
> >wrote:
>
> > Hello JMeter Community,
> >
> > I am trying to do some performance test on an authentication service
> > deployed at a very small testing OpenStack Swift cluster.
> > The important details about this is that in order to authenticate a user,
> > the user needs to supply two HTTP headers (X-Storage-User and
> > X-Storage-Pass). In return, an auth token is provided through HTTP
> headers
> > (X-Auth-Token).
> > Using HTTP Authorization Manager does not seem an option because I do not
> > see how I can force it to use those custom http headers.
> >
> > I can successfully authenticate using a single user by using the HTTP
> > Header
> > Manager and setting both required headers accordingly. In order to obtain
> > the resulting auth token, I suspect that I can just use a Regular
> > Expression
> > Extractor PostProcessor, but I have not verified that yet.
> >
> > I am having trouble doing authentication as described above when using
> > dynamic username/password combinations that are saved in a CSV file. It
> > seems like even if I use a CSV Data Set in order to create the user and
> > password variables, HTTP Header Manager ignores those variables. Instead,
> I
> > am literally seeing ${user} being sent through the wire.
> > I am not sure if this is due to the fact that HTTP Header Manager is a
> > Config Element which is only loaded initially. Or maybe HTTP Header
> Manager
> > is supposed to handle variables but I am doing something very wrong.
> > I don't see how I could insert variables into HTTP Headers otherwise, as
> > HTTP Request does not offer that option.
> >
> > I am fairly new to JMeter, so its possible that I am missing something
> > obvious. Any thoughts on the easiest way to accomplish inserting
> variables
> > stemming from a CSV file into HTTP Headers? (each thread, being a
> different
> > user, would use a different variable).
> > Maybe this is not possible at all and I will need to write my own
> > "component", maybe extending HTTP Request? (how straightforward would
> this
> > be, if this is the only way?)
> >
> > I am sorry if this was answered before, but no search results were
> helpful
> > :)
> >
> > Thank you,
> >
> > Pablo
> >
>

Re: Variables in HTTP headers

Posted by Deepak Shetty <sh...@gmail.com>.
+ThreadGroup
++WhileController
+++Debug Sampler
+++HTTPRequest
+++CSVDataSetConfig (user,password)
++HTTP Header Manager (${user},${password})
++ View Results Tree listener.
should work. If it doesnt its probably you arent reading the CSV correctly
(check jmeter.log). You can also add a debug sampler + view results tree
listener so that you can see what values the variables have


>I suspect that I can just use a Regular Expression Extractor PostProcessor,

Choose headers in the Response Field to check



regards
deepak

On Tue, Jul 12, 2011 at 8:42 AM, Pablo Llopis <pa...@gmail.com>wrote:

> Hello JMeter Community,
>
> I am trying to do some performance test on an authentication service
> deployed at a very small testing OpenStack Swift cluster.
> The important details about this is that in order to authenticate a user,
> the user needs to supply two HTTP headers (X-Storage-User and
> X-Storage-Pass). In return, an auth token is provided through HTTP headers
> (X-Auth-Token).
> Using HTTP Authorization Manager does not seem an option because I do not
> see how I can force it to use those custom http headers.
>
> I can successfully authenticate using a single user by using the HTTP
> Header
> Manager and setting both required headers accordingly. In order to obtain
> the resulting auth token, I suspect that I can just use a Regular
> Expression
> Extractor PostProcessor, but I have not verified that yet.
>
> I am having trouble doing authentication as described above when using
> dynamic username/password combinations that are saved in a CSV file. It
> seems like even if I use a CSV Data Set in order to create the user and
> password variables, HTTP Header Manager ignores those variables. Instead, I
> am literally seeing ${user} being sent through the wire.
> I am not sure if this is due to the fact that HTTP Header Manager is a
> Config Element which is only loaded initially. Or maybe HTTP Header Manager
> is supposed to handle variables but I am doing something very wrong.
> I don't see how I could insert variables into HTTP Headers otherwise, as
> HTTP Request does not offer that option.
>
> I am fairly new to JMeter, so its possible that I am missing something
> obvious. Any thoughts on the easiest way to accomplish inserting variables
> stemming from a CSV file into HTTP Headers? (each thread, being a different
> user, would use a different variable).
> Maybe this is not possible at all and I will need to write my own
> "component", maybe extending HTTP Request? (how straightforward would this
> be, if this is the only way?)
>
> I am sorry if this was answered before, but no search results were helpful
> :)
>
> Thank you,
>
> Pablo
>