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:
- In VuGen, open the Basic_Tutorial script
- Click the Step Navigator tab to display the Step Navigator.
- Insert a start transaction marker.
- In the Step Navigator, locate the step Search Flights Button.
- Double-click the Image: Search Flights Button step to display the corresponding web_image step in the Editor.
- Click View >Steps Toolbox. The steps Toolbox appears in the right pane.
- 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.
- 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.
- Insert an end transaction marker.
- In the Step Navigator, locate the step Submit Data: reservations.pl_2.
- Double-click the Submit Data: reservations.pl_2 step to display the corresponding web_submit_data step in the Editor.
- 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.
- 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.
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:
- Find the section where you want to vary the data.
- Select View > Step Navigator to show the Step Navigator in the left pane.
- In the Step Navigator, locate the Submit Data: reservations.pl step.
- 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.
- Change the fixed value to a varying value.
- In the Submit Form Step Properties dialog box, select seatPref in the seventh row of the grid.
- Click the ABC icon adjacent to the seatPref argument. The Select or Create Parameter dialog box opens.
- Create a parameter.
- In the Parameter name box, type seat.
- Click OK. In the Submit Form Step Properties dialog box, VuGen replaces the ABC icon with a Parameter icon .
- Click the Parameter icon adjacent to {seat} and select Parameter Properties. The Parameter Properties dialog box opens.
- Specify values for the parameter.
- Click Add Row. VuGen adds a row to the table.
- Replace the word Value with Window.
- Click Add Row. VuGen adds another row to the table.
- Replace the word Value with None.
- Keep the default settings in the Select column and File format sections of the dialog box.
- Define how the test will vary the data.
- Keep the default setting that instructs VuGen to take a new value for each iteration: Update value on: Each iteration.
- Click Close to close the Parameter Properties dialog box.
- 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.
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
- Click the Step Navigator tab to display the Step Navigator.
- In the Step Navigator, locate the Submit Form: reservations.pl step.
- On the VuGen toolbar, click the Snapshot button to display the Snapshot pane.
- In the Step Navigator, double-click the snapshot icon in the Submit Form: reservations.pl step. The corresponding snapshot appears in the Snapshot pane.
- From the VuGen menu, click View > Steps Toolbox. The Steps Toolbox pane appears.
- In the Steps Toolbox - Search box, type in web_reg, and then locate the web_reg_find step in the Filter Results.
- Drag the web_reg_find step from the toolbox into the Editor, before the web_submit_form function. The Find Text dialog box opens.
- In the Find Text dialog box, type Find Flight into the Search for specific Text box, and then click OK.
- 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:
- Click the Step Navigator tab to display the Step Navigator.
- In the Step Navigator, locate the last step, Image: SignOff Button.
- Double-click the Image: SignOff Button step. The Editor displays the corresponding web_image function.
- In the Steps Toolbox, under Common, locate the lr_output_message function.
- 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.
- In the Message Text box, type The flight was booked.
- Click OK. VuGen adds an lr_output_message to the script, and a corresponding step in the Step Navigator.
- 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.
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.
- Enable image and text checks.
- Click Replay > Run-Time Settings to open the Run-Time Settings dialog box.
- Click Internet Protocol > Preferences.
- Select Enable image and text check.
- Click OK to close the Run-Time Settings dialog box.
- 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.
- Locate the text check.
- Click the Output pane, and select Replay.
- Click in the Replay log, and then press Ctrl+F to open the Search dialog box.
- 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.
- Locate the beginning of a transaction.
- In the Replay log, press Ctrl+F to open the Search dialog box.
- Search for the word Transaction. This notification is shown in blue.
- View the parameter substitution.
- In the Replay log, press Ctrl+F to open the Search dialog box.
- Search for the word Parameter. The log contains a notification “seat” = “Aisle”.
- Search again (F3) for the next substitution. Note how VuGen takes a different value for each iteration.
- 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.
Load Runner Load Runner Training "
ReplyDeleteLoad 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