Wednesday, March 4, 2015

Load Runner: Measuring the duration of a business process


Load Runner: Measuring the duration of a business process

When preparing an application for deployment, you need to measure the duration of specific business processes—how long does it take to log on, book a flight, and so on. Each business process is normally made up of one or more steps or actions in your script. In a Vuser script, you designate a series of actions you want to measure by including these actions in a transaction.
When you run a Vuser script that includes a transaction, LoadRunner gathers information about the time it takes to perform the transaction, and displays the results in color-coded graphs and reports. You use this information to help determine if the application meets the performance requirements.
You can manually insert a transaction anywhere in a Vuser script. To mark a set of steps as a transaction, insert a start_transaction marker before the first step and an end_transaction marker after the last step.
In this section you will insert a transaction into your script to measure the amount of time it takes for the user to find and confirm a flight.

To insert a transaction into a Vuser script:
  1. In VuGen, open the Basic_Tutorial script
  1. Click the Step Navigator tab to display the Step Navigator.
  1. Insert a start transaction marker.
    1. In the Step Navigator, locate the step Search Flights Button.
    1. Double-click the Image: Search Flights Button step to display the corresponding web_image step in the Editor.
    1. Click View >Steps Toolbox. The steps Toolbox appears in the right pane.
    1. In the Steps Toolbox, under Common, select lr_start_transaction, drag it into the Editor, and release it before the web_image step. The Start Transaction dialog box opens.
    1. In the Transaction Name box, enter find_confirm_flight and click OK. VuGen inserts an lr_start_transaction step in the Step Navigator, and a corresponding lr_start_transaction function in the Editor.
  1. Insert an end transaction marker.
    1. In the Step Navigator, locate the step Submit Data: reservations.pl_2.
    1. Double-click the Submit Data: reservations.pl_2 step to display the corresponding web_submit_data step in the Editor.
    1. In the Steps Toolbox, under Common, select lr_end_transaction, drag it into the Editor, and release it after the web_submit_data step. The End Transaction dialog box opens.
    1. Make sure that find_confirm_flight appears in the Transaction Name box, and then click OK. VuGen inserts an lr_end_transaction step in the Step Navigator, and a corresponding lr_end_transaction function in the Editor.
You have now defined the find_confirm_flight transaction.
Emulating multiple users
In your emulation, you tracked a user booking a flight and choosing an aisle seat. In a real-life setting, however, different users will have varying preferences. To improve your test, you need to check if the booking will work when users select different seating preferences (Aisle, Window, or None).
To accomplish this, you will parameterize the script. This means that you take the recorded value, Aisle, and replace it with a parameter. You will place values for the parameter in a parameter file. When you run the script, the Vuser will use values from the parameter file (Aisle, Window, or None) thereby emulating a true travel agency environment.
To parameterize your script:
  1. Find the section where you want to vary the data.
    1. Select View > Step Navigator to show the Step Navigator in the left pane.
    1. In the Step Navigator, locate the Submit Data: reservations.pl step.
    1. Right-click the Submit Form: reservations.pl step and select Show Arguments. The Submit Form Step Properties dialog box opens.
The ABC icon to the right of each argument in the grid indicates that the argument has a fixed value.
  1. Change the fixed value to a varying value.
    1. In the Submit Form Step Properties dialog box, select seatPref in the seventh row of the grid.
    1. Click the ABC icon adjacent to the seatPref argument. The Select or Create Parameter dialog box opens.
  1. Create a parameter.
    1. In the Parameter name box, type seat.
    1. Click OK. In the Submit Form Step Properties dialog box, VuGen replaces the ABC icon with a Parameter icon .
    1. Click the Parameter icon adjacent to {seat} and select Parameter Properties. The Parameter Properties dialog box opens.
  1. Specify values for the parameter.
    1. Click Add Row. VuGen adds a row to the table.
    1. Replace the word Value with Window.
    1. Click Add Row. VuGen adds another row to the table.
    1. Replace the word Value with None.
    1. Keep the default settings in the Select column and File format sections of the dialog box.
  1. Define how the test will vary the data.
    1. Keep the default setting that instructs VuGen to take a new value for each iteration: Update value on: Each iteration.
    1. Click Close to close the Parameter Properties dialog box.
    1. Click OK to close the Submit Form Step Properties dialog box.
You have now created a parameter for the seating preference. When you run the load test, the Vusers will use the parameter values instead of the recorded value, Aisle.
When you run the script, the Replay log will show the parameter substitution that occurs for each iteration. The Vuser will use Aisle for the first iteration, Window for the second iteration, and None for the third iteration.
Verifying Web page content
When running a test, you often need to verify if certain content is found on a returned page. A content check verifies that expected information appears on a web page while the script is running. You can insert two types of content checks:
  • Text check. Checks that a text string appears on a web page.
  • Image check. Checks for an image on a web page.
In this section, you will insert a text check that checks if the phrase Find Flight appears on the Reservations page of HP Web Tours.
Inserting a text check
  1. Click the Step Navigator tab to display the Step Navigator.
  1. In the Step Navigator, locate the Submit Form: reservations.pl step.
  1. On the VuGen toolbar, click the Snapshot button to display the Snapshot pane.
  1. In the Step Navigator, double-click the snapshot icon in the Submit Form: reservations.pl step. The corresponding snapshot appears in the Snapshot pane.
  1. From the VuGen menu, click View > Steps Toolbox. The Steps Toolbox pane appears.
  1. In the Steps Toolbox - Search box, type in web_reg, and then locate the web_reg_find step in the Filter Results.
  1. Drag the web_reg_find step from the toolbox into the Editor, before the web_submit_form function. The Find Text dialog box opens.
  1. In the Find Text dialog box, type Find Flight into the Search for specific Text box, and then click OK.
  1. VuGen inserts a web_reg_find step into the Step Navigator and a corresponding web_reg_find function into the Editor.
When you replay the script, VuGen will look for the text Find Flight and indicate in the Replay log whether or not the text was found.

Produce debugging information
At certain points during a test run, you may want to generate and send messages that contain information relating to the script execution. These output messages will appear in both the Replay log in the Output pane, and in the Controller’s Output window. You can send a standard output message or a message that indicates that an error occurred.
The recommended way to work with error messages is to check for a Failed status. If the status is Failed, you instruct VuGen to issue an error message. For details, refer to the examples in the HP LoadRunner Function Reference.
In this section of the tutorial, you will instruct VuGen to insert an output message after the application completes a full booking.
To insert an output message:
  1. Click the Step Navigator tab to display the Step Navigator.
  1. In the Step Navigator, locate the last step, Image: SignOff Button.
  1. Double-click the Image: SignOff Button step. The Editor displays the corresponding web_image function.
  1. In the Steps Toolbox, under Common, locate the lr_output_message function.
  1. Select the lr_output_message function, drag it to the Editor, and release it after the web_image function. The Output Message dialog box opens.
  1. In the Message Text box, type The flight was booked.
  1. Click OK. VuGen adds an lr_output_message to the script, and a corresponding step in the Step Navigator.
  1. Click the Save button on the VuGen toolbar to save the script.
Note that to insert an error message you would repeat the same process, except that in the Steps Toolbox, you would select an lr_error_message function instead of the lr_output_message function.
replay of my test succeed
In this section, you will run the enhanced script and search the Replay log for text checks. You will view the results of the text checks, as well as details of the transactions and parameterization.
By default, image and text checks are disabled during playback since they require more memory. If you want to perform an image or text check, you need to enable checks in the run-time settings.
  1. Enable image and text checks.
    1. Click Replay > Run-Time Settings to open the Run-Time Settings dialog box.
    1. Click Internet Protocol > Preferences.
    1. Select Enable image and text check.
    1. Click OK to close the Run-Time Settings dialog box.
  1. Run the script.
Click the Replay button on the VuGen toolbar. VuGen begins running the script, generating entries in the Replay log in the Output pane.
Wait for the script to finish running.
  1. Locate the text check.
    1. Click the Output pane, and select Replay.
    1. Click in the Replay log, and then press Ctrl+F to open the Search dialog box.
    1. Search for web_reg_find.
The first instance says as follows:
web_reg_find started
Click Find Next to display the next instance of web_reg_find. The second instance says as follows:
Registering web_reg_find was successful.
This is not the actual text check—it only prepares VuGen to check for the text after the form submission.
Click Find Next to display the next instance of web_reg_find. This instance indicates:
Registered web_reg_find successful for “Text=Find Flight” (count=1).
This verifies that the text was found. If someone changes the Web page and removes the phrase Find Flight, then in subsequent runs, the output will indicate that the text was not found.
  1. Locate the beginning of a transaction.
    1. In the Replay log, press Ctrl+F to open the Search dialog box.
    1. Search for the word Transaction. This notification is shown in blue.
  1. View the parameter substitution.
    1. In the Replay log, press Ctrl+F to open the Search dialog box.
    1. Search for the word Parameter. The log contains a notification “seat” = “Aisle”.
    1. Search again (F3) for the next substitution. Note how VuGen takes a different value for each iteration.
  1. Select File > Save or click the Save button on the VuGen toolbar.
Reference: loadmeter.bg/lr                         
Note: Some of the articles are grab from various Websites / Blogs.

1 comment:

  1. Load Runner Load Runner Training "
    Load Runner Online Training
    Send ur Enquiry to contact@21cssindia.com
    Performance testing concepts
    What is Performance Testing?
    How Performance Testing Is Different Than Functional Testing
    If I am a Performance Engineer" more… Online Training- Corporate Training- IT Support U Can Reach Us On +917386622889 - +919000444287 http://www.21cssindia.com/courses/load-runner-online-training-105.html

    ReplyDelete