A Sample Vuser Script - WinRunner

In the following sample Vuser script, the “Ready” transaction measures how long it takes for the server to respond to a request from a user. The user enters the request and then clicks OK. The user knows that the request has been processed when the word “Ready” appears in the client application’s Status text box.

In the first part of the Vuser script, the declare_transaction and declare_rendezvous functions declare the names of the transaction and rendezvous points in the Vuser script. In this script, the transaction “Ready”
and the rendezvous “wait” are declared. The declaration statements enable the LoadRunner Controller to display transaction and rendezvous information.

Next, a rendezvous statement ensures that all Vusers click OK at the same time, in order to create heavy load on the server.

In the following section, a start_transaction statement is inserted just before the Vuser clicks OK. This instructs LoadRunner to start recording the “Ready” transaction. The “Ready” transaction measures the time it takes for the server to process the request sent by the Vuser.

Before LoadRunner can measure the transaction time, it must wait for a cue that the server has finished processing the request. A human user knows that the request has been processed when the “Ready” message appears under Status; in the Vuser script, an obj_wait_info statement waits for the message. Setting the timeout to thirty seconds ensures that the Vuser waits up to thirty seconds for the message to appear before continuing test execution.

The final section of the test measures the duration of the transaction. An if statement is defined to process the results of the obj_wait_info statement. If the message appears in the field within the timeout, the first
end_transaction statement records the duration of the transaction and that it passed. If the timeout expires before the message appears, the transaction fails.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

WinRunner Topics