How to parameterize jmeter?

In this article we are going to see how can we parameterize jmeter. That means , we will see how can we use variable passing values in jmeter. 
Mainly, this article is for novice like me. There are plenty of resource you may find from google. I am just making this for learning quickly.

So, first we have to
1. Declare the variable in some place in test plan
2. We have to use the variable in the test plan
As, jmeter test step will need the value during execution, so we can input value in 3 ways
1. Directly provide value(static)
3. Provide the value using txt/csv file
3. Provide value from previously performed step(ex-from any response data of previous test/step run)

1. Directly Value Insertion :(Static value)
Step 1: Go to test plan Insert
Step 2: Add a user define variable
Step 3 : Provide a variable name and its value.
Name section is the name of the variable, and value section is for value of the variable to use.
 
Step 4: Go to your request( i have used post http request) and use in following way
${NameOfTheVariable}. For example , I use NAME as name of my variable, so ${NAME}.
What will happen?.. Jmeter will send request as replacing the NAME with its value(in this case shantonu)


Standard Uses :
- Variable to send static requests
- Variable as name of the domain(to control main domain centrally)
- Variable as predefined data for comparison or validation
- Variable for debugging test cases

We can also  assign the user define variable from inside the Test Plan.
Add > config elements > User Defined Variables
 
This does the same as from Test Plan. But, we have to ensure that this should be assign before the step where that values can be used. It means , variable should be present before use either as parent or as ahead step.

Google plugin : jp@gc - Parameterized Controller does the same thing.


To add this , Add>Logic Controller >jp@gc - Parameterized Controller.
Well this plug in mainly used for referring other variables. We can use multiple jp@gc - Parameterized Controller. We can make a tree type reference relation between variables(one variable will point another , like that) with this. But, we need to keep careful about sequence of using this controller. In a test plan, this controller work sequentially(variable will pass one to another)

2. Value from CSV/TXT : 
Step 1: Add a  config element CSV Data Set Config under test plan
Step 2: Define the file from where data will be fetched(variable name and value)
Step 3: We can use some function like_CSVRead() and_StringFromFile()

I will Make a separate post on how to work with CSV Data Set Config. I am just showing a screen shot.

There is one issues with this ,  It can pass values to only one other config element which is Authentication manager.It does not pass value to other config elements.
So, mostly we use Google plug in.

Google Plugins :  jp@gc - Variables From CSV File