Parametrization in JMeter -2

Method2 Using preprocessor (User Parameter)

For a parameterization using CSV Config Element please read my previous post – Parameterization in Jmeter-1.

Steps:

1. To parameterize a login scenario for more than one user first record the login scenario.

2. Open a notepad and enter userid and password for three users.

Save the file as test.csv. The extension csv makes it a comma separated Value (CSV) file.

parajm1

3. Select the Login sample and add a “User Parameter” element to it.

Add->Preprocessor-> User parameters

parajm2

In parameters add three variables and fill it as shown in below figure:

parajm3

__CSVRead is a function which reads values from file test.csv . The second parameter of the function is the column number .Name is the variable name which is referenced in the request sample.

parajm5

Now select the login sample and change the values of userid and password to ${A} and ${B}.

parajm4

You can also generate the value for variable using function helper dialog. Open it from options or use shortcuts ctr+F. Choose __CSVRead from choose a function dropdown list. The value field of first row in the Function parameters represents the file name (here test.csv) and second row represents column number (e.g. 0, 1, 2…).

Now run the script and observe the result in view result tree.

Advertisements

8 Responses

  1. Hi,

    I used the same way, In the way that you mensioned in the above example but my values are not picked up from the CSV file, Please reply soon.

  2. Why don’t use CSV Data Set or User Defined Variables instead?

  3. For me too its not working ? Please provide necessary solution? As soon as possible

  4. you can try this by adding CSV “Data Set Config”, ensure that your file name ends with .csv in “filename field”

  5. It was not working for me as well at the first time. This is how you fix.. leaving it for reference for everybody who need…

    Silley mistake..

    Just remove the CSV header. It’ll work.

    Cheers!

    Pujitha N.

  6. how?? pls tell me in detail….

  7. we need to place test.csv in /bin right?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: