What is best practises to managed Jmeter script with csv file with usere id and password?

22 Views Asked by At

I am bit new to Jmeter and in performance testing world. I am bit strugling with best practises with test data where user id and password is saved in .csv file.

I know it is not good parcise to have user id and password in srouce code respository. But how to manage test data if I want to used 10 use id and passowrd for logins in my Jmeter script. I have plan to run these test in pipeline?

Any sugestion?

1

There are 1 best solutions below

0
Kenneth S On

The best way (in my opinion) is to pass in these values using an environment variable. You can then reference them using

${__P("user_name", "anonymous")}

The __P function is a shortcut for the __property function: https://jmeter.apache.org/usermanual/functions.html#__property

The first parameter is the name of the environment variable, the second is the value to use if that environment variable is not actually set.

If you don't want to use an environment variable, You can also pass the value in from the command line using the -J option:

jmeter -Juser_name="Johnny" -Jpassword="secret"

The values are accessed in the same manner using the __P function.