C Program to write loadrunner parameter output to text file


  • Assign the file name & location to the variable filename.
  • fopen() function is used to open the file.
  • a+ – Opens a file in read and write mode and sets pointer to the first character in the file. And, it can’t modify existing contents.
  • Use lr_eval_string() function to read the correlation parameter value.
  • fprintf() function is used to write into the file. 
  • fclose() function is used to close the file.

C Program:









Transaction validation in loadrunner using web_reg_find function

  • We can use the SaveCount attribute of web_reg_find function to validate the transactions.
  • SaveCount attribute of web_reg_find function saves the number of matches (count) found for the given text in a parameter.
  • We need to use this Count value in the IF block to validate the transaction.
  • If the Count value is greater than 0 we will pass the transaction else we will fail it.
Code Snippet:


Transaction validation in loadrunner using web_reg_save_param function


  • We can use the count of web_reg_save_param function to validate the transactions.
  • Set the ORDINAL value of web_reg_save_param function to ALL.
  • This will generate a parameter CorrelationParameter_Count to fetch the total matches found for our defined Left and Right boundaries.
  • We need to use this CorrelationParameter_Count value in the IF block to validate the transaction.
  • If  CorrelationParameter_Count value is less than 1 we will fail the transaction else we will pass it.
Code Snippet:


C Program to generate Randum numbers in loadrunner using srand() & rand()

Program 1 - Using Loadrunner Parameter

C Code:














Output:








Program 2 - Without Using Loadrunner Parameter


C Code:









Output:



Alternative steps in Loadrunner TruClient Protocol

  • Alternative steps helps you to choose different ways to perform the same action in a step. 
  • For example, in a drop-down list, Ajax TruClient gives you the option of specifying your selection by name or by the number in which it appears in the list.
  • Sometimes the recorded step selection method might not work. You can modify such steps to perform the given action using the alternate step selection. 
  • Steps that have alternative options are labeled with an alternative step symbol highlighted in the below image. Click it to view the alternative options for that step. Click the desired alternative and select Back.



  • Above is the snapshot of a step in which Customer ID "BM1005" was searched and selected.
  • The alternative steps feature gives you the four different options of defining of selecting the Customer ID "BM1005".
  • You can click on the play button (highlighted in the below image) on the right side to check how each step will behave, before finalizing on the correct step.
  • These alternate steps are something similar to ordinal value in web HTTP protocol.


Parameterization in TruClient Protocol Loadrunner - JavaScript Based (Method 2 - LR.getParam)


Step 1: Create a parameter under Parameters Dialog Box (Highlighted in RED). I have created a File Parameter of name “Username”


Step 2 : Click the Develop Script button

Step 3 : Fetch the parameters from “Username” using LR.getParam function (i.e.) replace the value to be parameterized with the following code LR.getParam(“Username”) in Value filed under Arguments section. (Code Highlighted in RED)



Step 4 : By default Value  field will be in Plain Text. Now click on the drop down arrow and select JavaScript <JS>. (Highlighted in GREEN)