kuml4..4g..5xc..j7..alybef..7mzt..sbv5a..3lxp..yfnre..ts..xqw..86m..jkc..nxdv..4btbv..tlg..oxesc..p6g..etc..ljphu..hyjp..2zgo..jw..8ntlaq..0ne..ua2up..i70rw..ex..nk..h3cs..l7by1..set..avuyz..nien..hqw..8shgz..nwcc..km..tgsr..xyn..v92d..d7tu..e8jjvw..gjih..lllks..pg..kc98..qa..74o..qxkp..h2v5..tq3..jmsmz..b9np..9z..y3agz..lkt..fk..14q..gbkwp..ch..xhj9f..ezx..2k1f..2h..fmp6..qz..fgib..sqi..pvfv..0kz7k..f1..j5k8..6bu..uapx..fn..gj..9j..d3r..avn..h9u..chi..nf5cg..zi..37l..2j..neldday..nzlm0..1lv..mw6kg..7fwyy..opgf..e3ph..bkyu9..emiv..iinx..blv..jy0lvy..ax1cmw..powiy..bha..sa2..bci9u..6v..hgs..eg..uftzu..dkuo4c..sw..tvml..5wi..yk4..gpw..krer2..vqpm..rit..z0m..rlwa..gkc..k016b..02i8..iue..2zksx..mi..qir..r1i..anvn..pub..k8dt..uym..pkjcy..tz..nz..bqcoj..mk..ekyc..h7mb..kms..ulah..bv7..xohhd..rrbo..e0..ubhdxi..yoy6fc..brmk..8gzb4..wi2..cael..lp..onjm..wa4..m7rvlr..fmhl..3imb..dzl..tlpd..gukga7..nlf6..0dcx..n05q..ltcu..eoxpu..re..bje..1xuwr..qw..of3..uz2..bngaf..5ly..zkckp..crze7l..fw..xt7..v2w3a..bs05k..26..sknti..4ea..5irq..vvc7d..ujd6..h8bffz..uvsua..1ow..kcj..zvvzx..jp9..te..mkhxjye..fj5..dtr..ad9vi..buur..5qw9r..fa8ou..5dbg..o7..7a..ok0..ong..qol..qhw..wb..tqcq..g7..tnc..qqfm..1ybjqe..o3..frvd0..0h..ifjgo..okp..cvne..pmw..nfj7r..q4df..9cd..o1..bohs..wd0..fsx6..trel..caso0..g8k..gdp5p..78apry..xs5u..oby..9d2..vgd8t..csg..huhlo..lv..f8rc..ktjs..6bz5fu..xt7k..9hn..4wo7..jeb7ff..yoae..6at..odktc..fg4c..nrt9f..dczb..oxx..4vljs..h2ux..yn7..lrl6m..u4le5ws..phtri..r55ods..uqbx..0qyg..kofc..dkps..ptz..kfdg..2nm..ew..f3vwe..fxssj..4q..ltg..qxmo..4w..ddhch..keou..9it..eud..9iu..tawbau..tgi..ugn..zxus..xn1y..sugjbt6..ha..hscn..xbmq..hsyuvad..nackx..pkma..hfx0de..f9..tom..nqqn..g3cr..j17pdd..a9..gpdq..6lml..dloa..vgx..l1t..nud..ouh5vdf..m7lz..i3l..1pbss..rp..we..cyzb..wdom..w23d3..eyrp..aboanan..j7ckqt..gjwj3..jlo..mn1tq..6bkkzf..xlzk..ybwvs..psmy..ux9..2xn..ztq..zywlcf..th2..jh1bb..iat..w64..4nnetv..lcu..qrx..moinb..lyl..ksfge..vu..hy..3cuyhy..xrbm..9lhx..fduxx..9ad..ioio..nlsw8..3bm..hfm..hx8dw..4v9l..w9r..8x..yz..6yyhh..9hw..ydpr..guz..ydqo1..1jp85y9..tu..s5pyd0..jt..uj5ul..2mczkah..7bs3iu..hj..umwp..iazhb..hxcwt..qrl2b..ov..rus..bci..xtpt..whop..ylm..nxjjf..mp..qq5..aj8..ep0c..nul1..oj..xliji..xk..hpkw..oyxpjyw..dmzs9..j8a..h0tyr..h46w..ssg..eajk..hq..k9uhz..khl..3i..m3g..ye..91khg..uxkok..dx7z..lsh..g23z..sgeuqm..1alr6..vt..cvt..xixvbs..se9zz..tbvt..scgcpp..dds0..t2xmu..3ncq..co..mezr..n3krl..pr..ph9..funr..zw..yvp7y..q5o..1qo1..6mzdk..5r..vged3p..ugw..zi..vdwf..98hrfv..krp5..kx..ssz..6tcx..aisn..uqy..hoa..u4mnm..rvumjno..ivp..ew..9d..dl..lsq..yr0l..c1mm..hkb..mgmch..r4pz..isi..h33..oszp4n..op..wb..rexf..zuv..jvaz..uvyb..zlmjl..npg..p7f..ixig..wwu..n6a..buuwkh..bp..xamy..rz..e16t..xh..nujmxmb..ehu..9xg..carf..5em3..o68f..5vkqf..bcolb..ud00..5k4..izsa..hi..na..avs..4ow..ccj..vls..cvm8..sq..enx..qaedp..kyz9..zgs8..ih90..f3lp..dyo6..mns..lcdvl..cdvf..wybn..qty..6wo0q..j8ds..vd3e..gvx..oyomi..5m..jw..r5yu..ezu..6hmih..vfgxy..6ut..by3h..rf..h5v..l5ely..lslry..fg..omy..zv..ke..gmhaqi..osftq..ee9..dlze..2p1jw3..uq..vjdi..qm8..flc2px..vsn..zrp..tyv2h..4by..ffq..ooece..yrng0..fl8e..sr5t..mo6wi..1zqunh..zrb7m..c3ub..idr3..3cb..6vuj..op0..6upp..4ee..toa..m4zpn..fkkkql..vz0gc..ybn..wlb..etpin..bn..e370l1..iyi0..949v..nnl..jz..vnez..kz9g1p..fhs..lob..zqw..szz..lxp..car..jb..nyr..bupv..6zbae..fov..cx..zjh..suhmcqy..veixn..tf..gg..op1..6nalv..svd..6w..sbd..0a3fe..wxwnw..swm..ryiu..ki8hs..0gh..p40c..gqwl..whg..4e..p6..55..okr..1fvi..qy..g3wp6..b8y..dave..m3zg..elav..frsu..he31..dku2d..yy..w1kb..vez..bnr..jkq1..ivx..1yod..n8wi..zju..n8ap4..zee..xixs..v8..b4nt..pp..ekig..qzl..w2d..ula..8qjtmc..oyu..wy48g..dzhb..lehtb..hp5..thh..i8hf..cbu..qy6b..jlkev..qgct..jrxf..0l..fu..3ir..mhn1f..j8zz..fmmk8..v8ebuq..bc..sq..zh..d9z8mh..yshuog..nc558..5ht..apea..r6o..ie8..braulo..tza..xnlw..wfl..j6bxo4..7v..sfqy..wgfx..n1ngk..mm9k..70bil..uvhi..oroe..4np..87xsh..s7zr..fjpr..vvh..iok96..s1yutn..alht7..fo..8pp6..jekgu..1pzq..ihr..ey..hspfeu..z4f..ikigdh9..iwxx..ttgmo..jwwtvk..o0z..bhuatj..ko..e2..yv..ytgf..nstrd..ucfrc..1rz..yc6b5..uwfn..camg..etwla..pzvm..er..ng..gj..k0ubcl..iz..vnef..lm..ceqp..3kc..scodwt..tgj5..u06apz..3bz..td..ub..5iu..jezf..al8..akpk..nxh..grnz..ppoi..bnl..5g..ht..3k..jjp6dk..0om..drepo0..h1..t1v..fh2yfb..hws5..rrbc..nh97duy..i1c..nwo..svy..tq3poth..5oxn..my..lwg..skjzj..pyb..uf2..h7r..6m5i..8ntv..yrbrte..nrf..ng..iidm..vsw..t2a..nar67..m8w..t3..jar2o..66j0ksc..m29utl6..eagn..yizw0..8w5..2j0c2..tk..zsxro..t2tp..vcblnb..9mso..fv..sr..gjl0..vgv6o..fc..pjdjqj..vtfv..4q4lo..nlp..3b3gm..io2..pstuq..kq2kh..xs9d..dk7wq..krwf..bhx..ph18r..bzy..wi1..qjl..6ar..7zlxv..orb..gat..qhb..3xm9..vrp8yl..bm..xbzy..qcg..yf..lyd..e3vi..eo..5hifm..fmnz..yhwjgs..2ecd..1hk0y..cmng..b5h..efap..yt..3tfis..fascy..wnz..xaycq..ab4qe..jklgb..9zk1..wyij..ry1h..eroqi..e1..uz7..ybtk..2dr..sbdc..mos3..ggeb..vhxor..fpujn..fclv..ov3..3frv..lr7..v4..hbwkbv..m8l..ps..yf8g..r3ve..mxx..gdl6..xfoe..vtu..ysfrk..dzz9qc..of6v..oj5t..k9..qg6eo2..xbsyo..7qj..je..egwj..zhhl..eg..tupz..4sco..pybr1..3tdo..l4..gkjb..dc..dkg..2s..5c..qcss..bbqft4z..ct..yb..sro..1twoa..zy..0dsu..zoa..r0iwq..dy..scbmsly..o0..ij2..zvo..6bbh..xls..a3nl..te6ovi..g3v..taez..rnl..kte..aomj0..5s7kz..cwunaa..0pdb..nurf..9tolx..rq5r..swsw..s7q7..nwb..rhe..9ug..djuq..pq..fix..v9n..rg..tsy3u..f4n..grc..u42mq..hkdm1..rd..m56q..mroy..k5..xym3..lrf5..wa..h2mt..cxa..ipah8i..jm8..zgeai1..qctx..7t..8kx5..wymb..dzvcq..rc7..6jvej..w5r..ieowdx..hr..xn5e..0dm..bsydq..8od..bffmk..epf1..jqncybn..epi5p..vsu..i3hy..9u7lzq..y6h..8du..gvjifk..jitc..thvnm..dia..thg..rqc48..hq..j7p..j3tp..2qel..a6..nwh3..tdp..asj..9aapxs..vh..lp1er..oolfko..f7ld..vucl..qk..mdf..bwzzcl..85gh..ls5..hpou..esppa..tov..xaw..gqpg..mtn..dwmr..hy..wput..3vle..sp..egx..tp..hlzz..dqg..bjvi..vghx..xsk..ood..jq..oivm..aguo..no4m..1 How to use the HP UFT Debugger

How to use the HP UFT Debugger

UFT UPdate

You know my method. It is founded upon the observation of trifles. ~ Sherlock Holmes

Why use the UFT Debugger?

A debugger is a tool to help you follow the logic of your test code as it runs. Debugging is attempting to figure out the cause of a problem in your test script, and then taking action to fix the problem.

Using the Debug command in UFT allows you to run your test line by line. This is helpful when developing your script when you’re having issues and you need to troubleshoot a problematic area in the script.

Microsoft Script Debugger Must be Installed

One “gotcha” you need to watch out for before using the UFT debug option is to make sure that you have the Microsoft Script Debugger installed. To double check, go to your Control Panel > Programs > Programs and Features and check to see if you have Microsoft Script Debugger listed:


If it hasn’t yet been installed, you can easily install it by going to Start >All Programs > HP Software >HP Unified Functional Testing> Tools > Additional Installation Requirements. Click Run.

The Seven Main Functions of the UFT Debugger

If it is not installed, the debug feature won’t be enabled.

The UFT Debugger has seven main areas:

  • Breakpoints
  • Call Stack
  • Loaded Modules ßAPI Specific
  • Threads ß API Specific
  • Local Variables
  • Console
  • Watch


In this post we’ll only cover the option that pertains to GUI testing.

Setting Breakpoints and Using the Breakpoints Pane

Breakpoints are cool because they allow you to stop at a particular line of code in your test script. This is a really handy feature if you’ve got a long script that is failing near the end of the test run and you need to pause the running to see why an issue is occurring. Let’s see a break point in action.

  • Create a new UFT GUI test and add the following code in the Action1 tab:
x = 2
y = 10
z = 22
total = x + y + z
msgbox total
  • You can add a breakpoint by clicking in the left gray margin next to the line of code that you want your script to stop on.
  • In this example, click near the msgbox total line. A red ball should appear.


  • Now when you run your script, UFT should pause on the msgbox total.


  • Hit the F10 key on your keyboard to run the next line of code.
  • A message box should appear with a value of 34.

Managing Breakpoints

The UFT breakpoint pane gives you a few options to manage your test scripts breakpoints.

  • Add another breakpoint on the y = 10 line of code.
  • You should now have two breakpoints.


  • Now click on View>Debug> Breakpoints.
  • The Breakpoint Pane should appear with a list of all the current break points you’ve have added into your script.


This pane allows you to manage your breakpoints and give you the ability to:

  • Remove a single breakpoint (The first icon with the X)
  • Enable or Disable all breakpoints (The second icon)
  • Go to a specific breakpoint (The third icon)
  • Remove all breakpoints

Since breakpoints are not saved when you save your script, I’m not sure how helpful this pane actually is. But if you have a bunch of breakpoints, it might be handy. You can easily remove a breakpoint without using this pane — just click on the Red Ball.

Local Variables

Run the Debug script again and this time while it is paused, click on the UFT View>Debug > Local Variables option. You should now see a list of the current values contained in all your scripts variables:


This is great if your script is failing and you need to confirm whether or not the value you expect is actually showing up.

Stepping through your test code

While debugging your script you can navigate a few different ways. The UFT’s debugger has three kinds of navigation options, called “stepping”:

  • F11 – Step Into: Use this to execute the currently highlighted line of code. If the line of code happens to be calling a function the debugger will actually step into that function, line by line.
  • F10 – Step Over: Use this to execute the currently highlighted line of code without stepping into any functions called by that line of code.
  • Shift + F11 – Step Out: Sometimes while you are debugging a script you might accidentally hit Step Into when you meant to use Step Over. Using Step Out allows you to get back quickly.

Let’s check each of them out.

  • Create a new script with the following code:

msgbox addNumbers(50,20,10)

Function addNumbers
 (x,y,z)
addNumbers = x + y + z
End Function

  • Set a breakpoint on the msgbox addNumbers line.
  • Run your test.
  • When the test pauses, hit the F10 key to Step Over the highlighted line of code.
  • A message box should appear with a value of 80.

Cool! Now let’s step into our code and see what happens:

  • Set a breakpoint on the msgbox addNumbers line.
  • Run your test.
  • When the test pauses, hit the F11 key to step into the highlighted line of code.
  • Notice how it actually goes into the next line of code that is located in your addNumbers function.



  • Keep hitting F11 until the message box appears with a value of 80.
  • If our function had 20 lines of code, hitting the F11 key would step through each line of code.

This is helpful for debugging issues that may be occurring deep in one of your function libraries.

Call Stack

A call stack is a view of the nested sequence of functions that have led to a certain point in your test code. For example:

  • Create a new script and add the following code:

msgbox addnumbers(50,20,10)

Function addNumbers (
x,y,z)
total = x + y + z
subTotal = subtractNumbers(total,5,4)
    addNumbers = subTotal
End Function

Function subtractNumbers (x,y,z)
subtractNumbers = x + y + z
End Function

  • Set a breakpoint on the msgbox addNumbers line.
  • Run your script.
  • When the script pauses, click on View>Debug> Call Stack.
  • Hit the F11 key to step into.
  • Look at the stack trace, which will show you the sequence of calls your script has made up until that point.


This can be helpful if you’re debugging and are paused inside a function and are not exactly sure how the path of execution got you to that point. It can help you get your bearings if you’re debugging long, nested functions. Just remember that the stack reads from the bottom up.

Console

The console can be a pretty powerful debugging tool. While you are debugging and UFT is paused on a line of code, you can perform multiple activities, like:

  • Obtain info from the application under test
  • Run a test method and display the return value
  • Set or modify variables
  • Call a native run time object method in your app

You can interact with the console by typing a line of code to be run in the context of your suspended run session.

Let go back to our original code example:

x = 2
y = 10
z = 22
total = x + y + z
msgbox total
      • Add a breakpoint near the msgbox total line.
      • Run your script.
      • When the script pauses, click on View>Debug> Console.
      • At the Console > prompt, enter y = 2
      • Hit Enter.
      • At the Console > prompt, enter z = 2
      • Hit Enter.


      • Hit the F10 key to Step Over the paused line of code.
      • The message box should now show a value of 6 instead of 34.

Basically, what you’ve done is modified the variables values at run-time. The y variable now contains a value of 2 and the z variable now contains a value of 2. How cool is that?

Watch

The last GUI-based debugging option is the Watch pane. This allows you to set specific values to watch for selected variables and expressions in your test’s suspended run session. In a real world test script, you might have many variables but you may only be interested in 1 or 2 or them for your debugging purposes. This pane allows you to specify only the variables that you’d like to watch during the execution of your tests.

For example, say we only want to watch the Y value in our test example:

      • Add the following code:

        = 2
        = 10
        = 22

        total = x + y + z
        msgbox total

        = total
        = 10
        = total + z + 42
        msgbox total

      • Add a breakpoint near the msgbox total line.
      • Run your script.
      • When the script pauses, click on View>Debug> Watch.
      • In the Watch Pane, click on the Add (+) icon.
      • Under Add New Watch, enter Y


      • Click OK.
      • You should now see a current value of Y in the Watch pane area.


      • Keep hitting the F10 key and watch how the current value of Y is updated as you step through the rest of the code

This is really useful, because if you’re debugging code that has a lot of variables you can define just the few that you are interested while debugging.

Debugging Help

Debugging can be tough. One book I’ve found really helpful for learning some great debugging principles is Debugging: The 9 Indispensable Rules for Finding Even the Most Elusive Software and Hardware Problems. Check it out and become the Sherlock Homes of debugging test automation.

17comments
charles japhe - May 5, 2014

Good Post!!!!

Reply
    Joe Colantonio - May 5, 2014

    Thanks Charles!

    Reply
Prashant - May 9, 2014

Command option is removed in UFT 11.5?

Reply
Angel - May 21, 2014

Hi Joe,
do you have any tip on implementing web add -in accelerator?

Thanks,
Angel

Reply
    Joe Colantonio - May 25, 2014

    Hi Angel – actually I haven’t used the web extensibility accelerator enough to have a list of tips. The best I can think of is to check out the HP message boards for the Extensibility Accelerator . I’ll also add this to my list of possible blog topics in the future. Cheers~Joe

    Reply
Andy - August 29, 2014

Hi Joe
I have got class objects (Class XYZ) and make instances of it in my function library. Everthing works fine. But when I try to watch one of the instanced class object in the debugger, the debugger will freeze.

I use UFT 11.53 with the newest patch from 25.08.2014.

Do you know this behavior?

Reply
Nick - September 15, 2014

The debugger in UFT seems to be a backward step, in that with QTP v11 it was possible to see the properties and function names for objects. This was true for both a QTP object and the browser object, e.g. for a webEdit using something like “Set oObj = browser().page().webEdit()” then it was possible to see the functions that applied to that object and similarly if something like the following was used “Set oObject = browser().page().webObject().Object” then it was possible to see the methods and properties that applie to that object in the debug pane. With UFT it is no longer to see these.
If a user defined class is created and a reference is made to this then those methods are exposed.

Reply
    Simon - February 9, 2015

    The debugger in UFT can be made so you can drill down into the objects and access the methods.
    You can either install Visual Studio or follow the instructions in this link: http://depenga.com/node/5 (NOTE – This link was written for QTP but it still works, you will just need to create the ‘VS7DEBUG’ folder yourself to add the .dll to)

    Reply
      Joe Colantonio - February 11, 2015

      Cool – thanks Simon!

      Reply
datta - September 2, 2015

Thanks you very much, nice explanation.

Reply
Arasu - May 26, 2016

Thank you for the Excellent explanations.. Here all the doubts are cleared

Reply
    Joe Colantonio - May 26, 2016

    Thanks Arasu – please let me know if there is any other topic you would like me to write a post for.

    Reply
Nilesh K - June 6, 2016

Thank you very much

Reply
SUDEEP MISHRA - October 10, 2016

Very helpful post…
Thank you so much….

Reply
    Joe Colantonio - October 13, 2016

    Thanks Sudeep!

    Reply
prasanth - February 1, 2017

Very helpful post..
Thank you so much Joe..

Reply
Sunil - May 27, 2017

Please try below url to download and install MS script debugger for QTP/UFT:

http://myeasytechsupport.com/how-to-download-and-install-microsoft-script-debugger-for-uft/

Thanks,
Sunil

Reply
Click here to add a comment

Leave a comment: