Monday, 20 February 2017

Getting started with Parameterization in Loadrunner

How to create a new script ?

Fileà New Script and Solution





Protocol selection:

Select a protocol based on the type of application, for generic web based applications; you can select Web – HTTP/HTML protocol. In case, you’re unaware of the type of protocol to be used for the recording purpose, you can take the help from the protocol advisor.

If you would like to test Web Services then you can use the corresponding web services protocol or if you want to connect to database then you can use the Oracle 2 – tier protocol, so depending upon the type of application, protocol is decided.





Before, you get started with the script recording, you must know the following three actions:-

vuser_init action contains all the requests corresponding to login transaction, basically this action part contains all the procedures that needs to be executed only once during the script initialization phase

vuser_end action contains all the requests corresponding to  logout transaction and contains procedures that will be executed once during the script completion phase i.e. in the end

Action contains rest other transactions that were part of the scenario

If you are running a script for multiple iterations, only the action would be executed multiple times whereas init and end section will be executed once.



Configuring the recording attributes

To start the recording, you need to select the type of action, that contains the procedure/request based on the scenario. If a scenario contains Login transaction, then the Recording type should be changed to vuser_init,  if you’re trying to record a logout transaction then recording type should be vuser_end.

In our scenario, we do not have any transaction that needs to be executed once so we’ll be using Action to record the entire scenario





Once you start the recording, the following window would appear and you can see the recording getting started on the right corner. You can add the transaction names by click on the highlighted button (that looks like timer)



For closing the transaction, refer the below snapshot:-




Same way you can keep on moving, by recording all the user actions based on the scenario just by changing the transaction names and recording the requests for that subsequent transaction.





After the recording is completed, the script would appear to be:




First thing, that needs to be done is, removing the irrelevant requests that has no relation with scenario

    web_url("iecompatviewlist.xml",
        "URL=https://iecvlist.microsoft.com/IE10/1152921505002013023/iecompatviewlist.xml",
        "Resource=0",
        "RecContentType=text/xml",
        "Referer=",
        "Snapshot=t2.inf",
        "Mode=HTML",
        LAST);


The end point URL has no reference with www. Blazedemo.com that we are trying to record so we can omit out these requests because it will lead the response times to increase





Next step will be parameterization:

Parameterization: It’s a process of managing the user input in order to facilitate it for multiple users or iterations.

So, you need to find the values which were entered by the end user in the application. Such as on the first page, the user selected the departure and the destination city.



In order to parameterize, follow the below procedure:-

Select the variable à Right Click and select Replace with Parameter à Create New Parameter




Assign a parameter name for the parameterized value:-




Same way, you can parameterize other values as well.

IMPORTANT: For an instance, you need to pass parameterized value in an ordered fashion such as; you want to pass Paris with Buenos Aires or London with Paris etc. so you need to follow different techniques during parameterization.

Let’s assume we need to pass Buenos Aires every time with Paris

Step 1.



Step 2. Assign the parameter name and click on properties

In Properties, select the file path for Paris i.e. parameter name of Paris (p_fromPort)



Step 3.

Once you have selected the File Path as p_fromPort.dat, Click on Add Column and click OK

Now, you can see that you have merged p_fromPort with p_toPort




You can also edit the notepad and add other parameters to that file using Comma “,” as a delimiter







Similar way, you can parameterize other values within the script



Stay tuned for more posts!!!



No comments:

Post a Comment