How to pass a random User/Pass (for Basic Authentication) with JMeter? -
I am using Jmeter to test an API. I have got set up the Basic Authentication
- It's working well.
Now, I'm trying to make credentials random JMM cross wire Therefore, in two ways I know that I can do this.
- Add a custom
HTTP header (via a
HTTP header manager element
) and then in random areas (i read from csv file Is set) - Use the
HTTP Authorization Manager element
and pass in the username and password.
Now, if I try and use the above method (1), then I need to create the following headers / data: -
Authorization: Original & lt; Some Base 64 Encoded String Formats Username: Password & gt; like. Authorization: Original ONXXOnBH3MX
Only simple. But the value of that header is not exceeding in the wire :( I can add any other header type and it is crossed in the wire ..
Hmm .. ok then .. try Method (2). / P>
Now it works .. But I can only do hardcode in the username and password. I can not see that I use the username VARIABLE (i.e. $ {usernmae}
) or a password different (i.e.. $ {password}
). The server is right Page / data gives the right answer.
So .. Can anyone please help?
- Create an HTTP Authorization Manager element
- Set the username and password to the variable, $ $ {username}, set to {password}
- Create a CSV file with your user names and passwords (do not use the header row)
- Create a CSV Data Set Config Element, "From Username With variable variable names, the password "(no quote, and no spack is
- Each thread / loop will read a different value from the CSV file. Alternatively, if you want the value to be randomly logged in, there are some functions that you can generate random numbers or send at the time of execution.
Comments
Post a Comment