I have the client id, tenant id, and endpoint URL for an application. I need to fetch the client's secret id from the azure key vault for authorization purposes in JMeter. I have found a custom JMeter function GetSecret can retrieve the secret value.
Can someone please tell me how to use that function in JMeter?
First of all you need to install the custom plugin
Download jmeter-plugins-azure-load-testing-stub-x.x.x.jar from here and drop the .jar under /lib/ext folder of your JMeter installation
Restart JMeter to pick the .jar up
Once done you should be able to use __GetSecret() function just like any other JMeter Function, i.e. here is the screenshot of the Functions Helper Dialog
Related
I want to make a request at the beginning of my test plan to get an auth token which will be sent with all the requests in my test plan. Is there a way to store the password required to get that auth token without other users being able to access it?
There is no such a thing as "BlazeMeter test plan", there is JMeter Test Plan which is basically XML file hence it is not possible to "securely" store passwords there because it will be saved as the plain text and everyone will be able to download it and see the password.
You can use __P() function in the test plan to read the password from a JMeter Property.
Once done for local executions you will be able to set the password via -J command-line argument like:
jmeter -Jpassword=secret -t test.jmx ...
In BlazeMeter test execution you can use JMeter Properties section to define the desired value of the password property
I have a password parameter inside of http authorisation manager But I would like to encrypt it first rather than just putting a plain password.
What would be a solution?
If your aim is to avoid having a plain password in jmx file, then you can pass it on command line using:
-Jpassword=mypassword
And in plan use function __P:
${__P(password)}
Otherwise, you can use a variable and use in a setup thread group a Flow Control Action that will contain a JSR223Preprocessor that will decrypt the password and create a property using:
props.put("password", decryptedPassword)
You can then just use the password using :
${__P(password)}
You cannot, JMeter's JMX test scripts are basically XML files so everyone will be able to guess the password by opening the file in the text editor.
If you put decryption logic somewhere in the test plan then everyone will be able to call the function and decrypt the password.
I would recommend going for __env() function (it's a part of Custom JMeter Functions bundle, can be installed using JMeter Plugins Manager) so the password will be read from your operating system environment variable, this way is more secure and continuous integration friendly.
I am testing an application hosted in gcloud, to execute the test using jmeter I require OAuth token for respective User credentials. I am able to generate the token for one credentials, however I have not been able to find a way to generate them for more than one users.
If anyone has faced such problem or has any glimpse please let me know.
Note:
I need a fresh token with every iteration since token expires in every 60 mins
I am able to generate token manually to run the test
I have tried auth/header manager for the process
I have tried console auth code generation code as well
Above all generate auth code for a specific credential, wherein I have to keep the application active.
So you want to apply load to app backend using authenticated users.
If so, why don't you use
CSV File to store your test credentials
Use JMeter's CSV Config to read those credentials
once only controller for authentication, extract access_token and refresh_token
Use tokens to make calls to your backend
If you need to run loadtest / soak test for longer than one hour you can use if controller to verify the token validity and renew the token if necessary.
Hope this helps.
If you need to refresh the token each 60 minutes it makes sense to create a separate Thread Group which will be executing a token refresh request each 60 minutes.
The token can be passed to the main Thread Group using __setProperty() function, you can make the token value thread-specific by combining it with __threadNum() function like:
In "token" thread group:
${__setProperty(token_${__threadNum},${token},)}
In "main" thread group you can read the value using __P() function:
${__P(token_${__threadNum},)}
Demo:
More information: Knit One Pearl Two: How to Use Variables in Different Thread Groups
I have a user flow (create base64 header auth > register request > Register > login > sending data) which I want to run simultaneously (100 users).
If I use the Thread Properties as it is, it will run in asynced way.
Examples:
User 3 will try to login with token of user 1, user 40 will register with registration header created for user 24 and so on..
Token for login extracted from base64 process,
another token is extracted from 'register-request' and used as variable in 'registration' header.
I want first user to register with token created in first register-request and login with token created in base64 process, and so on for next users.
Is there a way to do so?
Normally JMeter virtual users store variables in the thread-local storage so given your test plan design is good each thread (virtual user) should use its own header.
Not knowing the details of how your header is generated it's hard to say what's wrong, I would recommend using Debug Sampler and View Results Tree listener combination and double check the header value (and any interim variables) - hopefully you will be able to determine the cause. If not - you will need to share the test plan somewhere somehow.
Other things to consider:
If your application requires Auhtorization header in form of username:password encoded into Base64 you actually don't need to generate the header manually, you can use HTTP Authorization Manager which automatically generates and adds the relevant header to the requests. Check out How to Use HTTP Basic Authentication in JMeter article for more details if needed.
There is __base64Encode() function which you can use for encoding a custom string into Base64, the function can be installed as a part of Custom JMeter Functions bundle using JMeter Plugins Manager
I have scenario to test different concurrent multiuser with different login and password from CSV ,
and passing session info & values and run time generated values pass as parameter to next screens for multiple pages.
How can I build Test plan & configure JMeter.
The below mentioned steps will help you achieve the above scenario:
Record the scenario
http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf
Do correlation for dynamic parameters
http://apache-jmeter.blogspot.com/2011/12/correlation-regular-expression.html
Use CSV for login credentials
http://ivetetecedor.com/how-to-use-a-csv-file-with-jmeter/
hope this will help
Go through the following link (my answer), How to send parameters from one http request to other in jmeter
make sure to add http cookie manager & http session manager in your test plan for run time generated values.