Wednesday, October 20, 2010

JMeter : Reading variables from a file

Done a lot of load testing with JMeter.

Quite often, I need to try load testing for lots of user logins. To do this you can't hard code the value in the form - you have to somehow read it from a file.

Enter JMeter's String From File

"The StringFromFile function can be used to read strings from a text file. This is useful for running tests that require lots of variable data. For example when testing a banking application, 100s or 1000s of different account numbers might be required."

For a field called userId, enter something like the following in the Value column:

${__StringFromFile(x:\Path to csv file.csv,userId,,)}


It would look something like this:




The csv file is a simple one column list of user Ids.

Enjoy!

2 comments:

Rafael Orágio said...

Great turorial. It was exactly what I needed.

Rafael Orágio said...

Great turorial. It was exactly what I needed.