Saturday, December 23, 2006

Object Recognition in QTP

The problem of object recognition is a tricky one. Imagine receiving computer help over the phone when the caller tells you what to do to your machine by describing the objects they want you to interact with. For instance, if they want you to open the control panel (on a Windows XP machine), the steps involved might sound like
1. Click the button on your task bar, that has the word 'Start'
2. Click on the Control Panel list item in the displayed menu

In this instance, you are provided with enough description to uniquely identify an object you need to interact with. If you have two buttons, with the word start on it in your taskbar, then an additional piece of description must be provided such as

1. Click the leftmost button on your task bar, that has the word 'Start'

in order to still uniquely identify the object. This is what QTP does, it simply records a description of each object you interact with in your application into a file. The way it records the description is by noting enough properties of an object in order to uniquely identify such an object. Additionally, in order to find this object much easier in the future, it provides a logical name for the object. The logical name is simply an alias. This way, instead of saying

1. Click the leftmost button on your task bar, that has the word 'Start'

I can use a logical name such as btnStart.

There are three tools used by QTP for this operation and these include Object Spy, Object Identification and Object Repository. We will discuss these objects at length in later chapters. For now, it is more important to understand the concept that in order to teach QTP how to interact with your application, QTP must record descriptions of the objects you interact with and map these description to a logical name.

Labels: