jmeterjmx

How to parameterize username and password in jmeter?


How to remove hardcoding in the below code?

<stringProp name="Authorization.username">user123</stringProp><stringProp name="Authorization.password">pwd123</stringProp>

Solution

  • You can use __P() function to read the credentials from JMeter properties.

    enter image description here

    When you run JMeter test in command-line non-GUI mode you will be able to pass the credentials via -J command-line arguments like:

    jmeter -Jusername=user123 -Jpassword=pwd123 -t test.jmx .....
    

    More information: