How to pass a random User/Pass (for Basic Authentication) with JMeter?
Posted
by Pure.Krome
on Stack Overflow
See other posts from Stack Overflow
or by Pure.Krome
Published on 2010-06-15T05:40:08Z
Indexed on
2010/06/15
5:42 UTC
Read the original article
Hit count: 560
jmeter
|basic-authentication
Hi folks,
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.
- Add a custom
HTTP Header
(via anHTTP Header Manager Element
) and set then value to the random fields (ie. something I've read in from a csv file) - Use the
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?
© Stack Overflow or respective owner