QTP and Load Runner Scripts – Part 2
Now coming to the second method. But before we start, certain preparations need to be made.
In the QTP script, we need to manually insert lines of code to represent the Transaction boundaries and Action definitions. These are the terms used in Load Runner.
Transaction: represent units of actions for which performance characteristics is measured, monitored, and analyzed.
Action: is comprised of one or more transactions and represents a unit of iteration during a load test.
To start with second approach you need to:
- Add a second browser(other than in which the application will be running) to the QTP object repository.
- Declare two variables named ‘Server‘ and ‘Application‘ with values initialized to the name of the web server and the application that you will be recording against, respectively.
- Place a call to the Init subroutine by inserting a line with the text Init ( ). To alter the HTTP traffic to capture transaction boundaries and action definitions, ping commands are sent to the server, and an OK response is received for each such ping request.
The ping command has to be sent from a separate browser than the one running the Siebel application. The Init subroutine handles the task of creating the separate browser window to send the ping commands and capturing the resulting OK responses so that the main browser running the Siebel application is not affected.
The subroutine calls manually inserted into the QTP script result in ping commands being sent to the server that represent:
- The start of an action with the action name.
- Beginning of a transaction with the transaction name.
- End of a transaction with the transaction name.
- The ping commands appear in the HTTP traffic which gets captured by LoadRunner.
The AutoGenerate utility (Autogenerate.exe) then performs post-processing on the LR script to identify and replace the ping commands with lr_start_transaction and lr_end_transaction calls that identify a transaction. The AutoGenerate utility also splits up the LoadRunner script into different .c files based on the action definitions in the QTP script.
To represent the beginning and end of an action, insert the following lines of code:
- CreateNewAction “vuser_init”: To represent the start of an action.
- CreateNewAction “vuser_end”: To represent the end of a action.
- To represent the beginning and end of a transaction, insert the following lines of code:
- StartTransaction “<Transaction_Name>”: To represent the start of a transaction.
- EndTransaction “<Transaction_Name>”: To represent the end of a transaction.
Save the edited QTP script (the script now contains transaction and action definitions). Start the Virtual User (VU) Generator module of LoadRunner in the Record mode.
<< Previous in series Next in series >>

(3 votes, average: 4.67 out of 5)






