Parameterization

                           Parameterization is the technique using which we can execute a test plan multiple times with different set of data. This helps in creating load test script that closely simulated real-world scenarios where different users use different test data.
Suppose, we have to do load test of a search engine like google. First step will be to record the search scenario. Now to do effective load test, we can't just playback the script for say 500 users. We should simulate 500 users that search for 500 different things. For this we can use parameterization, wherein we can have a CSV file that contains 500 different search keywords. Now instead of the static search item that we had recorded in our script, we can include the search items from the CSV file dynamically.
In jmeter, one of the common ways to parametrize your performance scripts is to use a CSV file. The best example of CSV input files usage is a login process. If you want to test your application across different users, you need to provide a list of user credentials.
Let’s assume that we have a login request that works for one specific user:
The following screenshots guide you to how to do parameterizatio
Step 1: open jmeter
step 2: add thread group
step 3: add HTTP sampler
step 4: enter all details as shown in the screenshot like ip address ,port ,method and path and also peaste the body of the request.
step 5: Now instead of email and pass we need to pass the parameters.
To achieve this we have to go for parameterization.
To pass any variable we have to use this format ---------- ${parameter name}
so here instead of name we enter ---------${email}
instead of pass we enetr ----------${password}
screen shot : 1


screenshot 2:


                  To pass the parameters we are using csv data config element .As shown in above screen shot add csv data congig element to thread group.
Configeration elements in csv data config element:
step 1 :First prepare the valid test data i.e. email and passwords and save those in a file with the extension of a file as “.csv” .Now browse that file path .
Step 2: leave the file encoding as it is.
Step 3: we have to enter variable names as like as how we enetere the column names in csv file (email , password) with comma or space or tab separated
step 4: hit on the drop down and choose whether we wanna ignore first line or not.
If we wanna ignore first line -----------choose TRUE if not choose FALSE.
Step 5 : choose delimeter either we used the delimeter as space/ camma/tab
step 6: If you wanna allow quoted data is choose TRUE if not choose FALSE
step 7: If you wanna recycle the data then choose TRUE if not FALSE
step 8: choose the EOF as FALSE if you choosen the above as TRUE if not choose FALSE
step 9: sharing mode will be all threads means ---- All the threads will share the data from csv file
If you choose current thread----- Apply only for perticulat thread only.

Note: To know whether the data is passing as parametere or not we can check by adding listner.
Step 1: Add the listner (view result tree)
step 2: run the test
step 3: Hit on the view result tree
step 4: hit on request.
Now as shown in the below screenshot the parametrs are passed instead of email and password.




No comments:

Post a Comment