Ad Home

Theme images by kelvinjay. Powered by Blogger.

Travel

Header Ads

Java

Selenium

UFT

Framework

General QA Concept

BDD

» » How to Record in QTP or UFT

As QTP supports record and playback options. It is very important to understand about the recording options available in QTP/UFT In QTP we have three recording options.

  • Standard recording mode
  • Analog recording mode
  • Low level recording mode
Standard Recording Mode This is the default mode in qtp/uft which can record all operation. QuickTest's normal recording mode records the objects in your application and the operations performed on them. This mode is the default and takes full advantage of QuickTest's test object model, recognizing the objects in your application regardless of their location on the screen.
Navigation: Automation>Record 
Or 
Select Record option on automation toolbar 
Or 
Use short cut key (F3) 

During recording QTP generates VbScript statements in Test Pane, Simultaneously it stores objects information into object repository. Steps for Normal recording: Steps for preparing a Test (through Recording): 
1. Put AUT in base state 
2. Select Record Option 
3. It shows Record and Run Settings, Select type of Environment (Windows or Web) 
4. Select Record Option (It shows two Options) 
    4.1. Record and Run Test on any open window based applications
    4.2. Record and Run only on If we select first option it records on any opened application on Desktop. If we select Second option, it asks for the path of the AUT, After Providing the path it records only on that particular application.) 
5. Click OK 
6. Perform actions on AUT 
7. Stop recording. 
8. Save the Test 
 Here is the way to record in normal mode: 
1. Click the Record button or choose Automation > Record. If you are recording for the first time in a test and have not yet set your recording preferences (by opening the dialog box manually), the Record and Run Settings dialog box opens. It is divided by environment into several tabbed pages. 
2. To choose an environment, click a tab.
3. Set the required options, as described in the following sections. 

4. To apply your changes and keep the Record and Run Settings dialog box open, click Apply.
 5. When you have finished the operation, click OK to save your changes and start recording. Guidelines for Modifying Record and Run Settings After you set the record and run settings for a test, the Record and Run settingsdialogbox will not open the next time yourecord operations in that test. If needed, you open the Record and Run Settings dialog box by choosing Automation > Record and Run Settings. You should set or modify your record and run preferences in the following scenarios: • You have already recorded one or more steps in the test and you want to modify the settings before you continue recording. • You want to run the test on a different application or browser than the one you previously set in the Record and Run Settings dialog box. If you change the record and run settings for additional recording sessions, confirm that you return the settings to match the needs of the first step in your test before you run it. 

All about the web options:Record and run test on any open browser Instructs QuickTest to record on any open Microsoft Internet Explorer browser and run on any open supported Web browser (refer to the QuickTest Professional Readme for information on supported browsers). Note: You must open the Web browser after you open QuickTest and select this option.TipYou can instruct QuickTest to ignore selected browsers that are open during the record and run session. Open the following address when a record or run session begins Instructs QuickTest to open a new browser session to record and run the test using the specified URL address. When recording a test, the address is opened in a Microsoft Internet Explorer browser. When running a test, the address is opened in the browser type specified in the Open the following browser when a run session begins box. NoteIf you define a value for the URL_ENV environment variable, that value overrides the value specified here during a run session. Open the following browser when a run session begins Instructs QuickTest to open the specified browser type when running a test: • Microsoft Internet Explorer • Netscape 8.x • Firefox 1.5 Notes: Only those browsers currently installed on your computer are available in the list. If you define a value for the BROWSER_ENV environment variable, that value overrides the value specified here during a run session. Do not record and run on browsers that are already open Instructs QuickTest not to record or run tests on any browsers that are already open prior to the start of the record or run session (and prior to opening QuickTest). Selecting this option also prevents you from viewing the properties of these browsers using the Object Spy. Close the browser when the test closes Instructs QuickTest to close the browser window specified in the Address box when the test closes. 

All about Window based option:Option Description Record and run test on any open Windows-based application Instructs QuickTest to record and run on any open Windows-based application. Note: Make sure that all the applications on which you want to record are currently closed. QuickTest can record on the applications that you open manually only after you select this option and click OK. Instances of these applications that are already open when the Record and Run Settings dialog box opens may be ignored or may not be recorded correctly. Record and run only on Instructs QuickTest to restrict its record and run operations to one or more of the following options: 

Applications opened by QuickTest:This option records and runs only on applications invoked by QuickTest (as child processes of QuickTest). For example, applications opened during a record or run session using a SystemUtil.Run statement, or using a statement such as Set shell = createobject("wscript.shell"); shell.run "notepad". 

Applications opened via the Desktop (by the Windows shell):This option records and runs only on applications that are opened via the Windows Desktop. For example, applications opened from the Windows Start menu, by double-clicking executable files in the Windows Explorer, by double-clicking ashort cuton the Windows Desktop, or by clicking icons on theQuick Launch bar. 

Applications specified below:This option records and runs only on applications listed in the Application details area. This is the recommended option to use. When working with standard Windows applications only, you can manually add steps to your test and then run them, even if you select this option and leave the Application details area blank (or if the list does not contain the application for which you want to add a step). Note: Make sure that all the applications listed in the Application details area are currently closed. QuickTest can record only on the instances of the specified applications that are opened after you select this option and click OK. Instances of these applications that are already open when the Record and Run Settings dialog box opens may be ignored or may not be recorded correctly. Application details Lists the details of the applications on which to record and run the test. For more information on the details displayed. If you define values for one or more environment variables, those values override the values in the Windows Applications tab during a test run. By these above methods we can get the script but in the object repository we might get extra unnecessary objects. So to avoid this a little advanced approach will be to add those required object to OR[Object repository] and then perform normal recording. Shortcut Ctrl+R or by navigating to Resources to Object repository.
Disadvantage:
It records User Mouse and Keyboard operations on AUT with respect to objects, but unable to record continuous mouse operations like Digital Signatures, graphs, paints etc. When working with specific types of objects or operations, however, you may want to choose from the following, alternative recording modes: 

Analog Recording Mode: Here QTP can identify the object but can not record.For example QTP can identify the paint/drawing bar normal mode but can not draw the picture or can not draw a signature by normal mode.To solve such problem we will choose analog recording mode. QTP will identify the object and the analog operation over it.It will record the keyboard and mouse movement on the recognized window. Similarly,when testing signature we use Analog Recording Mode. Analog Recording enables you to record the exact mouse and keyboard operations you perform in relation to either the screen or the application window. In this recording mode, QuickTest records and tracks every movement of the mouse as you drag the mouse around a screen or window. We can use this mode for recording continuous mouse operations. however it does not generate steps for each operation, generates total user actions in a Track File. The Track file is not editable. There are two mode of recording: 1. Relative to specific window 2. Relative to screen 

Relative to window: Activate this option if and only if operations performed on UAT located within one window.During this mode QTP tries to identify the window location and can perform operations(record the analog step) even if it is located in different location. Interestingly QTP does not record any keyboard operation or mouse movement outside this window. Active Screen image of the final state of the window is captured. 

Relative to Screen: This is a very rare scenario where we need to perform some analog recording with respect to screen. This is applicable during run time that is execution time also.It can also be possible if the AUT is having multiple windows opened. No active screen shot is taken/captured during this type of recording 

Best to use while Automating: 
1. Paint operation 
2. Drag and drop 

 Navigation: 

1. Keep tool under recording mode 
2. Automation >Analog Recording OR Use Short cut Key (Shift + ALT+F3) 

 Steps for preparing a TEST (through Analog Recording): 

1. Launch AUT (or we can launch AUT through QTP) 
2. Select Record option 
3. Automation>Analog Recording 
4. Analog Recording Settings Dialog box opens (In this Dialog box two options available.    4.1. Record relative to the screen 
 4.2. Record relative to the following window If we select first option QTP records User operations with respect to Desktop co-ordinates. If we select Second option, we have to show the window (AUT), after showing the Window it records with respect to that window co-ordinates.) 
5. Select any one option in the dialog box and click Start Analog record. 6. It records User actions 7. Stop Recording This mode is useful for recording operations that cannot be recorded at the level of an object, for example, recording a signature produced by dragging the mouse. Note: You cannot edit Analog Recording steps from within QuickTest. To execute this QTP invokes RunAnalog command like-
Desktop.RunAnalog "Track1"
' This is for Relative to the scren but for relative to a window the code will be--
Window({name of the window}).RunAnalog "Track2"

Both these two recoding mode eats up huge disk space. So please do not use these if not required. Mixing of normal analog mode of recording is possible and we can switch to these modes if required. 

Low Level recording: QTP can not identify the object under test.Hence it can not proceed with recording.As QTP can not identify or recognize the application under test,Analog Recording Mode can not be operated. So if we need to test such application,we need to activated Low Level recording.By enabling this mode of recording, QTP will identify obejects and by default class window or win Object and will record all keyboard and mouse operation. Low Level recording enables you to record on any object in your application, whether or not QuickTest recognizes the specific object or the specific operation. This mode records at the object level and records all run-time objects as Window or WinObject test objects. Use Low Level Recording for recording in an environment or on an object not recognized by QuickTest. You can also use Low Level Recording if the exact coordinates of the object are important for your test. In this level of recording QTP identifies co ordinates mostly to record and run. Note: Steps recorded using Low Level Recording mode may not run correctly on all objects. It records some operations on Non-supported environments apart from Normal operations. This mode records at the object level and records all run time objects as window or winobject Test objects. Use Low Level Recording for recording in an environment not recognized by QTP. 

 Navigation

1. Keep tool under recording mode
2. Automation >Low Level Recording

Steps for preparing a TEST (through Low Level Recording):
1) Launch AUT (or we can launch AUT through QTP) 
2) Select Record option
3) Automation> Low Level Recording 
4) Perform options on AUT 
5) Stop Recording 
6) Save the Test So similarly between analog and low level recording,in both cases QTP uses keyboard,mouse and work on co-ordinates.But difference is in Analog mode QTP can identify the object in UAT but in Low level recording ,it can not. One more important aspect of low level recording is it majorly depends on the co-ordinates. So in normal mode if the co ordinates changes for an object,still QTP will identify the object and performs operations. But in such case where co ordinates like location of the object is very important, we can use low level recording to check the location of the object. Mostly It supports Click,DbClick,Drag,Drop,Type,Activate,Minimize,Restore etc.

«
Next
Newer Post
»
Previous
Older Post

No comments:

Leave a Reply