≡ Menu

Joe Colantonio – Selenium-UFT-QTP-SoapUI-ALM-LoadRunner & more

Let me Help YOU Succeed with Test Automation

Joe Colantonio

Test automation, like all development efforts, is difficult. Most projects don’t succeed. You can do better! Learn some quick and easy test automation techniques to help YOU succeed with all your test automation projects. Sign up now for:

  • The latest HP Patch Alerts & Selenium updates
  • Tip’s,How-to post  & Videos for Performance, GUI, & API Testing
  • Tech Book Reviews

Just enter your email below and click “Get Free Updates!”

UFT/QTP – How to use the HP UFT Debugger

UFT/QTP – How to use the HP UFT Debugger post image

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.

Book Review – The Every Computer Performance Book

Book Review – The Every Computer Performance Book post image

The Every Computer Performance Book

In my experience as a performance test engineer, I’ve found that the actual creation of the test script to be the easiest part of the job. The difficulty comes when having to analyze and make sense of the reams of performance data that is gathered during a test.

[click to continue…]

The #1 Killer of Selenium Script Performance and Reliability

The #1 Killer of Selenium Script Performance and Reliability post image

The #1 Killer of Selenium Script Performance and Reliability

Do your scripts suffer from the following automation test flaky symptoms?

  • Test randomly fail
  • Works on your machine but not on another machine
  • Test take a long time to run
  • False positives/negatives results
  • Unreliable test run in CI have you contemplating a new career as a sheep herder

If so, your test might suffer from a common under-diagnosed automation disease known as Stinky Synchronization Syndrome.

One of the biggest killers of test automation script reliability is the failure to use proper synchronization/wait points in Selenium. Read the rest of this post to learn how to treat this world wide epidemic.

[click to continue…]

UFT 12 – How to run HP UFT GUI on a Mac using Safari

UFT 12 – How to run HP UFT GUI on a Mac using Safari post image

How to use UFT 12′s new functionality to run UFT script on a Remote Mac in Safari

If you listened to my recent podcast episode on the top new feature for UFT 12 you may have heard that UFT 12 now supports running UFT GUI test on a remote Mac in an Apple Safari browser.

Using this new technology preview feature you can have UFT use the WebSockets protocol to connect to any Mac machine that you specify. The current limitation is that you can only run Web based test objects with this feature. All the other test object types like Utility will not work on the remote machine. [click to continue…]

Test Talks Podcast Episode5 – Top new Features in UFT, LoadRunner and ALM 12

Test Talks Podcast Episode5 – Top new Features in UFT, LoadRunner and ALM 12 post image

Test Talks a Podcast dedicated to Test Automation Episode 05

I recently released the fifth episode of TestTalks where we geek out about HP’s latest version 12 release of UFT, LoadRunner and ALM. This is my first solo episode – let me know what you think.

[click to continue…]

Book Review – Selenium WebDriver Practical Guide

Selenium WebDriver book review

Want to really learn Selenium WebDriver?

Do you want to learn the ins-and-outs of Selenium WebDriver? If so, you should definitely check out Selenium WebDriver Practical Guide: Interactively Automate Web Applications Using Selenium WebDriver by Satya Avasarala (Packet Publishing).

What the Selenium WebDriver Practical Guide covers

This guide was written to help test engineers that already have some basic Java experience increase their mastery of Selenium WebDriver. The book is broken up into ten main chapters covering:

[click to continue…]

How to Create an Automated Testing Framework

How to Create an Automated Testing Framework post image

Test Talks a Podcast dedicated to Test Automation Episode 3

I recently released the third episode of TestTalks, where we geek out about creating an automated testing framework with John Sonmez, founder of Simple Programmer.

Episode 3 is all about Automation Frameworks

johnSonmez

Do you want to learn the best practices for creating a maintainable Selenium test automation framework? John Sonmez shares his top automation tips with us in this exciting episode. Some questions covered are:

  • John reveals his top recommendations to make automation tests maintainable and less brittle.
  • Resources to help learn test automation
  • Best advice for someone who is working on creating a new automation framework
  • Do you need to be a developer to create automated tests?
  • Benefits to create a layered test automation architecture
  • Personal branding for test automation engineer – how to keep your job or get a better one.
  • Plus much, much more! Hear more now.

Leave a review on iTunes
iTunesSubscribe

If you like what you hear on TestTalks go to iTunes, subscribe, give us a rating and hopefully a five star review. If you’re cool enough to do that, I’ll give you a personal shout-out on an upcoming episode!

Want to Talk?

If you have an automation success story you’d like to share on an upcoming episode, let’s talk! Send your suggestions to: feedback@testtalks.com

UFT API – Are RPC Web Services Supported?

UFT API GUIDE

Does UFT API support RPC web services?

I’ve been asked this question several times. The current version of UFT API/Service Test does not support RPC type web services. If you need more information about the RP support, I wouldn’t be able to explain it any better than the HP help documentation about RPC services:

[click to continue…]

Test Talks Podcast Episode2 – The Selenium GuideBook

Test Talks Podcast Episode2 – The Selenium GuideBook post image

Test Talks a Podcast dedicated to Test Automation Episode 2

I recently released the second episode of TestTalks where we geek out about Selenium test automation with Dave Haeffner. 

Episode 2 is all about Selenium

SeleniumGuideBookDave is the author of the new book the Selenium Guidebook and he takes time to talk with us about some key points from his book. He reveals Selenium testing secrets like:

  • What programming language to use when developing Selenium tests?
  • How to make a great automation framework
  • Ways to make your scripts less brittle
  • Running test in CI and much much more.

Leave a review on iTunes

If you like what you hear on TestTalks go to iTunes, subscribe, give us a rating and hopefully a five star review. If you’re cool enough to do that, I’ll give you a personal shout-out on an upcoming episode!

Want to Talk?

If you have an automation success story you’d like to share on an upcoming episode, let’s talk! Send your suggestions to: feedback@testtalks.com

[click to continue…]

REST Testing with Java Part Two: Getting Started with Rest-Assured

REST Testing with Java Part Two: Getting Started with Rest-Assured post image

Testing JSON REST Service with rest assured; part 2 Given, When, Then

In my last post, we went over getting started with rest-assured. Now that we have everything set up, I’d like us to take a look at a few more examples of using Rest-Assured to test JSON REST services.

[click to continue…]

css.php