Converting TruClient scripts to Web-protocol scripts in LoadRunner 12.0

(This post was written by Yang Luo (Kert), from the LoadRunner R&D Team)

 

HP LoadRunner provides two solutions for load testing over the Web: the transport-based Web HTTP/HTML protocol, and the TruClient protocol. The difference between them is that the transport-based protocol simulates client requests at the network level while TruClient involves an actual browser engine.

 

In LoadRunner 12.00, a new feature, ‘TruClient to Web’, has been introduced to provide more flexibility. This feature can generate a web transport script from an existing TruClient script (either TruClient Firefox or TruClient IE). The generated web transport script contains the same business process as the original TruClient script, and at the same time most of the TruClient metadata, such as logs, comments, transactions and code structures, is also converted to the equivalent Web HTTP script elements.

 

Here are some reasons why you might want to convert a TruClient script to a Web HTTP/HTML script:

  • You want to test a business process with low to moderate load, so you record a TruClient script.  When you want to scale the same business process up to significantly higher workloads, you’ll need to convert the TruClient script to the Web HTTP/HTML protocol which is more efficient at running the virtual users.
  • You want the efficiency of a Web HTTP/HTML script, but you love TruClient’s user-friendly recording experience, so you can record it on TruClient and then convert it to the Web HTTP/HTML protocol.  As a bonus, you also get useful metadata recorded by TruClient, such as comments about GUI-events that aren’t recorded by the Web protocol.
  • You want to run a large number of virtual users exercising the same business process, but you want to drive some of them through the GUI to monitor end-user experience.  Typically, you’d record the business process in TruClient, and then convert it to the Web HTTP/HTML protocol.  You would then run most of the virtual users as Web Protocol virtual users, with the rest of the virtual users running the original TruClient script.

This conversion feature is very easy to use. Just open a TruClient script (either TruClient Firefox or TruClient IE script), and click on the ‘Convert’ button highlighted below:

p1.png

 

A dialog will open, prompting you for some information. Here you can name the new script, specify the directory, and change the web script recording option properties by clicking the “Options” link (in the same way that you would modify them before recording a new Web HTTP script or regenerating an existing one). When the configuration is completed, click on the “Convert” button in the dialog: 

p2.png

 

The conversion process will begin. As it progresses, the TruClient script is replayed on the screen. Meanwhile, a progress bar is displayed. When the TruClient script finishes being replayed, you will see the familiar web code generation progress bar, and a new web script will be added to the current solution in no time at all:

 

p3.png

 

If you go through the new web script, you will find that it contains the same business process as the original TruClient script. Besides the web access APIs, the following information is also carried over to the new script:

 

Logs

In a recorded Web HTTP script there are often dozens or hundreds of requests, some of them initiated by user, others by the browser, making it difficult to understand which script lines correspond to which user actions. Logs from the TruClient script (ie. JavaScript calls to LR.log) will be converted to calls to lr_output_message to help you understand what’s going on:

p4.png

 

Parameters

Defining parameters and value lists is an important part of script development, and requires some time to configure. When the TruClient script is converted, any parameters and value lists that you created are automatically converted for you:

 

  • LR.advanceParam calls will be converted to lr_advance_param calls.
  • LR.setParam calls will be converted to lr_set_param calls.
  • For LR.getParam calls, the web script will use {paramName} directly, and an appropriate comment will be generated.
  • The parameter file (param.dat) will be copied to the new script:

p5.png

 

Transactions

The same transaction APIs will be generated in the web script, surrounding the web steps representing the equivalent business flow:

p6.png

 

Comments

The same comments will be generated in the web script:

p7.png

 

Think Time

TruClient wait steps will be converted to lr_think_time calls (when the interval is longer than the threshold in the options):

p8.png

 

Organization of Actions

  • TruClient steps in Script_View_Init will be converted to the vuser_init action.
  • TruClient steps in Script_View_Action will be converted to the Action file.
  • TruClient steps in Script_View_End will be converted to the vuser_end action:

p9.png

 

 

User Data Points

Calls to LR.userDataPoint in the TruClient script will be converted to lr_user_data_point calls:

 

p10.png

 

 

Text Verification 

 Text verifications will be converted to calls to web_reg_find in web protocol.

  • In the TruClient script, text verification follows the step which should be verified; in the web script, web_reg_find is called before the request that is to be verified.
  • Not all verifications in TruClient can be converted (such as some operators, or scope attribute)  

p11.png

 

Virtual User Status Message Information

LR.vuserStatusMessage steps in TruClient script will be converted to lr_vuser_status_message calls:

p12.png

 

GUI Events

GUI-only events in the TruClient script will be converted to comments:

p13.png

 

 

Run-Time Settings

Run-Time Settings will be copied to the new script if there are equivalent settings in the web protocol:

p14.png

 

 

Some notes about the converted script

  • The generated script is a starting point, but you still need to perform some enhancements to make it pass the replay. For example, the amount of effort for  correlation in the new script will be same as a “native” web script.
  • TruClient scripts execute JavaScript code during replay. But because the web protocol can’t run JavaScript code, some functionality could be broken.
  • Before conversion, make sure your system proxy is configured properly so that the TruClient script can successfully replay.

 

 

We hope you found this article useful.  Let us know by leaving a comment in the box below.

 

You can download LoadRunner here.

 

 

Thanks to Kert for providing this article!

 

Comments
| ‎04-08-2014 04:32 PM

Very cool!  I'm looking forward to trying this.  

 

There have been several times over the years that I'd considered creating QTP driven vugen http script creation.  

 

Rather than create such a monstrosity I always decided repeatedly rerecording was probably easier.  Thankfully it doesn't look like I'll ever have to create that kind of solution because of TC2Web.  

 

This looks great, thanks!

vbk | ‎04-09-2014 02:56 AM

nice post. thanks for the heads up. does protocol bundle of 11.5 same as 12?

| ‎06-19-2014 11:24 AM

Cool Feature !! .. We start playing around... 

Nice to see HP listen  to customer feedback , ready to go out of the box, and try different method, process  to enhance the tool that helps the performance testing process faster and reliable  in the Software Development  Life Cycle.

 Kudos to HP R&D team to make this happen.   Looking forward to have more such user-friendly features added in near future…

 

Thank You,

 

Dhondi Kranti(anon) | ‎07-01-2014 02:19 AM

Hi,

 

Good feature for running high volume of users.

 

My question is will the correlation of web protocols will also be done automatically when trueclient is converted to web script or how are we going to handle it.

 

Regards,

DhondiKranti

 

Leave a Comment

We encourage you to share your comments on this post. Comments are moderated and will be reviewed
and posted as promptly as possible during regular business hours

To ensure your comment is published, be sure to follow the Community Guidelines.

Be sure to enter a unique name. You can't reuse a name that's already in use.
Be sure to enter a unique email address. You can't reuse an email address that's already in use.
Type the characters you see in the picture above.Type the words you hear.
Search
About the Author
Malcolm is a functional architect, focusing on best practices and methodologies across the software development lifecycle.


Follow Us
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation