Você está na página 1de 25

QTP Training

2008, Cognizant Technology Solutions. All Rights Reserved. The information contained herein is subject to change without notice.

Testing Services

Solving Object Recognition Problems

Objectives
After completing this chapter, you will be able to: To recognize objects that are not normally recognized by QuickTest using: analog and Low Level recording Bitmap checkpoint Virtual object

Object Recognition using recording mode

Analog Recording Low Level Recording

Object Recognition
Analog Recording Use analog recording for applications in which the actual movement of the mouse is what you want to record. These can include drawing a mouse signature or working with drawing applications that create images by dragging the mouse. Low Level Recording Enables you to record on any object in your application, whether or not Quick Test recognizes the specific object or the specific operation. This mode records at the object level and records all run-time objects as Window or Win Object test objects. Use low-level recording for recording on environments or objects not supported by Quick Test .If the location of the object is important to your test, switch to Low Level Recording to enable Quick Test to record the object in terms of its x- and y- coordinates on the screen.

Object Recognition
Using Analog Recording You can switch to Analog Recording mode only while recording. The option is not available while editing. To record in Analog Recording mode: 1. If you are not already recording, click the Record button to begin a recording Session. 2. Click the Analog Recording button or choose Automation > Analog Recording. The Analog Recording Settings dialog box opens.

Object Recognition
3. Select from the following options: Record relative to the screen. Quick Test records any mouse movement or keyboard input relative to the coordinates of your screen, regardless of which application(s) are open or which application(s) you specified in the Record and Run Settings dialog box. Select Record relative to the screen if you perform your analog operations on objects located within more than one window or if the window itself may move while you are recording your analog operations

Object Recognition
4. If you choose to Record relative to the following window, click the pointing hand and click anywhere in the window on which you want to record in Analog Recording mode. The title of the window you clicked is displayed in the window title box. 5. Click Start Analog Record.

6. Perform the operations you want to record in Analog Recording mode. All of your keyboard input, mouse movements, and clicks are recorded and saved in an external file. When Quick Test runs the test, the external data file is called. It tracks every movement and click of the mouse to replicate exactly the operations you recorded.

Object Recognition
7 .When you are finished and want to return to normal recording mode, click the Analog Recording button or choose Automation > Analog Recording to turn off the option. If you chose to Record relative to the screen, Quick Test inserts the Run Analog step for a Desktop item. For example:

Desktop.RunAnalog "Track1" If you chose to Record relative to the following window, Quick Test inserts the Run Analog step for a Window item. For example:

Window("Microsoft Internet Explorer").RunAnalog "Track1 The track file called by the RunAnalog method contains all your analog data and is stored with the current action.

Object Recognition
Using Low Level Recording You can switch to Low Level Recording mode only while recording a test. The option is not available while editing a test. To record in Low Level Recording mode:

1. If you are not already recording, click the Record button to begin a recording session. 2. Click the Low Level Recording button or choose Automation > Low Level Recording. The record mode changes to Low Level Recording and all of your keyboard input and mouse clicks are recorded based on mouse coordinates. When QuickTest runs the test, the cursor retraces the recorded clicks.

Object Recognition
3. When you are finished and want to return to normal recording mode, click the Low Level Recording button or choose Automation > Low Level Recording to turn off the option. The following examples illustrate the difference between the same operations recorded using normal mode and Low Level Recording mode. Suppose you type the word mercury into a user name edit box and then click the TAB key while in normal recording mode. Your test is displayed as follows in the Keyword View and Expert View:

Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours"). WebEdit("userName").Set "mercury"

Object Recognition
If you perform the same action while in Low Level Recording mode, QuickTest records the click in the user name box, followed by the keyboard input, including the TAB key. Your test is displayed as follows in the Keyword View and Expert View:

Window("Microsoft Internet Explorer").WinObject("Internet Explorer_Server"). Click 564,263 Window("Microsoft Internet Explorer").WinObject("Internet Explorer_Server"). Type "mercury" Window("Microsoft Internet Explorer").WinObject("Internet Explorer_Server"). Type micTab Example for Low Level Recording : If we need to maximize the window use low level recording as there is no method associated with the browser

Bitmap Checkpoint
Bitmap Checkpoint checks an area of your Web page or application as a bitmap. For example, suppose you have a Web site that can display a map of a city the user specifies. The map has control keys for zooming. You can record the new map that is displayed after one click on the control key that zooms in the map. Using the bitmap checkpoint, you can check that the map zooms in correctly.

Bitmap checkpoints are supported for all add-in environments


The results of bitmap checkpoints may be affected by factors such as operating system, screen resolution, and color settings. Quick Test does not capture any part that is scrolled off of the screen, for example

Bitmap Checkpoint

Virtual Object Wizard


Learning Virtual Objects You can teach QuickTest to recognize any area of your application as an object by defining it as a virtual object. Virtual objects enable you to record and run tests on objects that are not normally recognized by QuickTest. Defining a Virtual Object You can define virtual objects only for objects on which QuickTest Professional records Click or DblClick methods. Otherwise, the virtual object is ignored. For example, if you define a virtual object over the WinList object, the Select operation is recorded, and the virtual object is ignored.

Virtual Object
To define a virtual object: 1. With QuickTest open (but not in record mode), open your Web site or application and display the object containing the area you want to define as a virtual object. 2 .In QuickTest, choose Tools > Virtual Objects > New Virtual Object. Alternatively, from the Virtual Object Manager, click New. The Virtual Object Wizard opens.

Virtual Object
3. Select a standard class to which you want to map your virtual object

If you select the list class, specify the number of rows in the virtual object. For the table class, select the number of rows and columns. Click Next.

Virtual Object
4. Click Mark Object.

The QuickTest window and the Virtual Object Wizard are minimized. Use the crosshairs pointer to mark the area of the virtual object. You can use the arrow keys while holding down the left mouse button to make precise adjustments to the area you define with the crosshairs. Click Next.

Virtual Object
5. Click an object in the object tree to assign it as the parent of the virtual object.

The coordinates of the virtual object outline are relative to the parent object you select.

Virtual Object
6. In the Identify object using box, select how you want QuickTest to identify and map the virtual object. If you want QuickTest to identify all occurrences of the virtual object, select parent only. QuickTest identifies the virtual object using its direct parent only, regardless of the entire parent hierarchy. For example, if the virtual object was defined using Browser("A").Page("B").Image("C"), QuickTest will recognize the virtual object even if the hierarchy changes to Browser("X").Page("Y").Image("C"). If you want QuickTest to identify the virtual object in one occurrence only, select entire parent hierarchy. QuickTest identifies the virtual object only if it has the exact parent hierarchy. For example, if the virtual object was defined using Browser("A").Page("B").Image("C"), QuickTest will not recognize it if the hierarchy changes to Browser("X").Page("B").Image("C").

Virtual Object
7. Specify a name and a collection for the virtual object. Choose from the list of collections or create a new one by entering a new name in the Collection name box.

8 Perform one of the following: To add the virtual object to the Virtual Object Manager and close the wizard, select No and then click Finish. To add the virtual object to the Virtual Object Manager and define another virtual object, select Yes and then click Next. The wizard returns to the Map to a Standard Class screen, where you can define the next virtual object.

Virtual Object Manager


The Virtual Object Manager contains all the virtual object collections defined on your computer. From the Virtual Object Manager, you can define and delete virtual objects and collections.

Note: The virtual object collections displayed in the Virtual Object Manager are stored on your computer and not with the tests that contain virtual object steps. This means that if you use a virtual object in a test step, the object will be recognized during the run session only if it is run on a computer containing the appropriate virtual object definition. To copy your virtual object collection definitions to another computer, copy the contents of your <QuickTest installation folder>\dat\VoTemplate folder (or individual .vot collection files within this folder) to the same folder on the destination computer.

Virtual Object Wizard


Presentation

Virtual objects enable you to record and run tests on objects that are not normally recognized by QuickTest.

QuickTest identifies a virtual object according to its boundaries. Marking an objects boundaries specifies its size and position on a Web page or application window.

Define Virtual Objects

Select Standard class

Mark Object

Save Object

Summary
In this session , we learnt about To recognize objects that are not normally recognized by Quick Test using: analog and Low Level recording Bitmap checkpoint Virtual object

Thank you

2008, Cognizant Technology Solutions. All Rights Reserved. The information contained herein is subject to change without notice.

Testing Services

Você também pode gostar