Reputation: 86937
I'm using JMeter to stress test an API. I've got Basic Authentication
set up - seems to be working great.
Now, i'm trying to randomize the credentials that JMeter passes across the wire. So, there's two ways I know I can do this.
HTTP Header
(via an HTTP Header Manager Element
) and set then value to the random fields (ie. something I've read in from a csv file)HTTP Authorization Manager Element
and pass in the username and password there.Now, if I try and use method (1) above, I need to create the following header/data :-
Authorization: Basic <some Base64 encoded string in the format username:password>
eg.
Authorization: Basic OnVzZXIxOnBhc3Mx
Kewl. simple. BUT that header value is not getting passed across the wire :( I can add any other header type and it's passed across the wire..
hmm .. ok then .. lets try method (2).
Now that works .. but I can only hardcode in the username & password. I can't see how I can pass in a username VARIABLE (ie. ${usernmae}
) or a password VARIABLE (ie. ${password}
).... If it's hardcoded, then the server correctly replies with the correct page/data.
so .. can someone please help?
Upvotes: 9
Views: 12609
Reputation: 7707
I would recommend trying the following:
Alternately, if you want the value to be truely random for the login, there are some functions you can use to generate random numbers or send in the time of execution.
Upvotes: 11