HTTP User Parameter Modifier

The User Parameter Modifier uses an XML file get values for HTTP arguments. Any HTTP Request that this modifier modifies will be checked for the existence of the specified arguments. If found, the values for those arguments will be replaced by the values found in the xml file. The XML file can have multiple sets of the same values. This modifier will iterate through these values in a round-robin style, thus each request will get a different set of values until the last set of values is reached, at which point it will begin again at the first set.

We can use HTTP User Parameter Modifier to parameterize a sample. In this example we will parameterize a search query to Google.


1. Record the Google site with a search entry “Jmeter”. Add a Listener. (Add->Listener->View results tree).


The Send Parameter with request in search sample looks like below picture. The variable name for search query is q and value is Jmeter. We will parameterize that value from an external file for two persons.


2. Now to generalize the value for parameter q we have to get values from data.xml file. The search queries put in the data.xml file are proxy and Blogs. Copy the contents the contents of the below two files in a note pad and save them as data.xml and sample.dtd in bin directory.


<?xml version=”1.0″?>
<!DOCTYPE allthreads SYSTEM “sample.dtd”>


<!ELEMENT allthreads (thread+)>
<!ELEMENT thread (parameter+)>
<!ELEMENT parameter (paramname,paramvalue) >
<!ELEMENT paramname (#PCDATA) >
<!ELEMENT paramvalue (#PCDATA) >

3. Add HTTP User parameter modifier to search sample. (Add->preprocessor->HTTP User parameter modifier).In that element change the File Name value to data.xml (the default file is users.xml).


4. In Search sample replace the value of parameter q with *. Make sure to give number of threads (users) to 2 in Thread Group.


5. Now run the test. In view results tree the response data will be shown. See the result of search response in Render HTML view. The values have been passed from the file.hum_5


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.


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.


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

Add->Preprocessor-> User parameters


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


__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.


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


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.

Simple Parameterization in Jmeter:

When you want to run/execute one test plan for more than one user at the same time you go for parameterization. It is a method of generalizing an action.

Here is a simple example to parameterize a Google search for three different users.

1. Record a simple Google search in Jmeter. Put the search keyword as “Jmeter”. The result will be something like this.


We will parameterize the search keyword “Jmeter”.

2. Now add a CSV Data set Config and a Listener element to the thread group.

Add->Config Element->CSV Data Set Config
Add->Listener->View Results Tree

3. Now open a notepad (inside bin) and enter your keywords.


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

4. Now select the CSV Data set Config element and fill in the fields as follows

Filename: search.csv

(Give the path name if you have put it inside a subfolder e.g. foldername\search.csv)

Variable Names: A

(This variable name is referenced in the search sample.)

Delimiter: ,


5. Now go to search sample and change the value of variable q to ${A}.In Jmeter we reference a variable using ${} .For each iteration the value of q will be replaced as fetched by variable A.


6. Now go to thread group and make the number of threads (users) to 3.

7. Run the script(ctr+R) and observe the result in result tree.


Parametrization in JMeter -1

Method1-Using CSV config element

Parametrization comes into picture where we need to input data repeatedly. Please read the previous post to know how to do a simple parametrization in JMeter.


1. Record a webpage(Sample/Request) having login Scenario.

2.Now we need a CSV data file from which we will import the values that are to be parametrized.Open notepad and enter Username and Password separated by commas.



Save the file as “myfile.csv”.(inside bin folder)

3. Add->ConfigElement->CSV DataSet Config.Fill the fields as follows

Filename: myfile.csv
Variable names: A, B
Delimiter: ,
Recycle: true
Stop: false

You can give the variable names as you wish.(like UID,PWD).The variable names are reference d inside the sample.

4. Open the login sample(request).Goto ‘Send parameter with the request’ section

Now change the value of Username field to : ${A}
and value of Password field to : ${B}

Here A and B are the variable names set in CSV Data Set config.

6.make sure to set number of threads(users) accordingly.

7 .Run the script and observe the result in result tree.