Back to Blog

Recording in TruClient – Part 2

Introduction to TruClient – Part 1
Enhancing a TruClient Script – Part 3
Working with Objects, Variables, and Code in TruClient – Part 4  

Recording in TruClient

First add a new script using the TruClient – Web protocol.  To record a script, you’ll need to select what browser you want to use.  On the toolbar, you’ll see a drop down next to the Develop Script button.  Select which browser you would like to use.  I suggest doing most of the scripting with Firefox since it seems to be the most mature of the TruClient browsers and uses less resources than Chromium.  Though, IE has the smallest resource footprint of available browsers.

Click Develop Script.  This will launch a LoadRunner version of the browser.  LoadRunner has its own version of both Firefox and Chromium in the LoadRunner bin directory.  It doesn’t use your local copy like the Web HTTP/HTML protocol does.

You’ll also want to set the recording level for your application.  It is suggested to record and play back in recording level 1.  This offers a cleaner, easier to use script.  Often events like mouse movements are recorded in level 2 and 3.  If you have a very sensitive script you may need to use level 2 or 3, ideally you can adjust the level for individual steps in the script when needed.

Record the application as you normally would.   Unfortunately, you can’t add transactions or verification during recording.  You’ll have to do all that after recording.

After recording:

Disable or possibly delete any Mouse Over events, these are usually only recorded on script level 3 in the 12.5 version but may be in a level 1 script in earlier versions.  These are typically not needed unless there is specific need for mouse over events.  I would suggest only deleting them if you are sure they are not needed.

Play back the script one step at a time and add enhancements using the Functions available in the Toolbox on the left-hand side of the Action window.

  • You should add a wait for object after every step that makes a synchronous server call.  You can also use a verify, which is similar but allows for slightly more control.  One big difference between the two is with verify you wait for certain text to be visible while wait for object just waits for the object to appear.  Be sure to update the wait time if needed, since the default is 20 seconds.
  • At any time during play back you can interface with the browser manually.  This is helpful if you need to parameterize a step and haven’t done so.
  • Note that some JavaScript functions may not work with step by step play back.  This appears to clear all variables in the current scope.  LR functions also may not work.  You should play back the script from the start for the functions to have proper scope or replay the steps that assigns the variables.

Add transactions.  It is suggested that all object actions should be part of a transaction.  This is the best way for LoadRunner to report errors with failed transaction.  It is suggested to select the steps or multiple steps via ctrl click and right click and select Surround with Transaction.

Add a wait between all transactions.  See Dealing with Think Time section below.

General Notes on TruClient:

TruClient uses both JavaScript and XPath extensively.  It is highly recommended you review the basics of both.  Some very high level overview is given here but to truly unleash the power of TruClient a solid understanding of both JavaScript and XPath is required.

Next Up:
Enhancing a TruClient Script – Part 3

Back to Blog