For QTP Scripts & Other Information visit: www.gcreddy.


QuickTest Professional

QuickTest Professional 10.00 Product ID: QTPRPID 10.00/0 Version: Build: 513


For QTP Scripts & Other Information visit:

I. Basic Features of QTP II. Key Elements of QTP III. QTP Testing Process IV. Generating Tests V. Enhancing Tests VI. Debugging & Running Tests VII. Actions VIII. Functions IX. Regular Expressions X. Environment Variables XI.



For QTP Scripts & Other Information visit:

I) Basic features of QTP
o QTP Launched in 2002 (Nov). By Mercury Interactive. Later taken over by HP,
in 2007.

o QTP is an Object Based Testing Tool. o QTP is for functional and Regression Testing.
o It follows Keyword driven approach.

o It supports Windows Operating Environment only. o It supports GUI based (Graphical user interface) and Web based Applications
Automation, does not support CUI (Command user interface) Applications. o It has multilingual support. (It supports English, Chinese, Japanese, Korean, etc languages with respect to license.)

o It has adapted Microsoft Visual Basic Scripting edition for programming and
excel like spread sheet for Data driven testing.

o SQL (Structured query language) embedded or inserted with QTP, so we can
use SQL statements directly from QTP.

o It can be integrated with other Tools like WinRunner and Quality Center. o It can be used for user interface (UI) test case automation and some limited
(Non UI) Test case automation like File system operations and Data base operations. o It was derived from Astra QuickTest (mother tool of QTP).

o It supports IE (Internet Explorer) only for recording tests, for execution it
supports other browsers like Mozilla and AOL, opera Etc apart from IE.

o QTP is a Desktop Application (I-Tier/Stand alone). o QTP has two types of License,
1. Seat or Node locked License, 2. Concurrent or float license. Seat license for one system and Concurrent License, we can use for any system but one user at any time. If we want multiple concurrent licenses we can purchase.

o QTP has UNI code support.



For QTP Scripts & Other Information visit:

Version History of QTP
• • Astra Quick test (Mother tool of QTP) 1.0 to 5.0 Quick Test Professional 5.6 – Nov 2002 6.5 – 2003 8.0 – 2004 8.2, 8.3 –2005 9.0,9.1-2006 9.2- 2007 mercury interactive 9.5 –2008 H.P 10.00 –2009 January

• • • • • •

Add-In Manager
QTP supports almost all industry leading technologies, but by default it does not support, with respect to add in license it supports. Default Add- ins of QTP are: • • • Activex Visual basic Web.

Other available Add Ins are: .Dot NET, Java, People soft, Siebel, TE (Terminal Emulators), SAP for GUI, Sap for Web, Oracle Apps, Web Services etc. During QTP launching it shows Add in manger dialog box, Add in Manger lists out all available Add Ins in the company. User needs to select appropriate Add Ins for his application or AUT. One can select more than one Add Ins also; if we select unnecessary Add Ins QTP performance will be reduced.



For QTP Scripts & Other Information visit:

Launching QTP
We can launch QTP BY selecting desktop icon otherwise start > programs> QTP Professional > QTP. During launching it shows Add-In Manager.

Add-in manager window Select appropriate Add Ins and click okay. Quick Test Launches



COM 6 .gcreddy.GCREDDY.For QTP Scripts & Other Information visit: II) Key Elements of QTP Tool Window www.

(It is a local concept) Action: It is a set of Statements.GCREDDY.COM 7 . used for creating. Test pane has 2 views. viewing and deleting test scripts. (It is a local concept) Statement: A minimal executable unit. It is a global concept. method.Test in VB script format. statement etc). (Keyword such as function. Test: It is a set of statements or set of one or more QTP Tool Window 1) Test Pane: It is programming interface of QTP.gcreddy.For QTP Scripts & Other Information visit: www. editing. www. Statements may have keywords. Expert view.

Navigation: Tools Menu> view options> we can use font size and colors etc. if you perform any modifications in one view those automatically reflects in another view. 2) Active Screen www.Test in Icon based GUI QTP Test Pane-Expert View Key word view. Note 2: Technical users use expert view and business user use key word view. QTP Test Pane-Keyword View Note1: Here in test pane Test is same but views are different.For QTP Scripts & Other Information visit: www.gcreddy. Note 3: User can customize Test pane view options.COM 8 .

www. Navigation: View menu>active screen (for launching and closing) Configuring active screen: view>options>active screen tab>increase /Decrease capture level.COM 9 .GCREDDY.gcreddy. Note 1: Generally novice testers use this feature but it occupies lot of memory space on QTP. apply and okay. it takes snap shots of every statement that user performed action or operation on AUT. It can be used for understanding and editing the test It has an optional element of QTP.For QTP Scripts & Other Information visit: www.

For QTP Scripts & Other Information visit: www. Navigation: View menu>Data table (for launching and closing) Data driven Testing: Testing the same task(S) or same operation with multiple sets of test data.COM 10 3) Data Table Active Screen It has an integrated spread sheet (Excel like).gcreddy. used for Data driven testing. www. It can be used in two ways.

GCREDDY.for specific action only.gcreddy. QTP has Data table methods for performing operations on data table. 2. 1. (Available in result window) Run time is a carbon copy of design time data table. Action Sheets.For QTP Scripts & Other Information visit: www. Sql Server. Run time data table.for entire test /used for all actions in the 1. oracle. Design time data table.COM 11 . excel sheets. (Attached with every test) 2. 2. www. Data table available in 2 ways: 1. etc. Enter test data directly into Data Table and use.) It has two types of sheets. Importing data from external files (Flat files. etc) and Data bases (MS access. Global Sheet.

(debug commands) www. It can be used for debugging the tests by step-by-step execution. We use step QTP Tool window.Data Table 4) Debug Viewer It is used for locating and rectifying or fixing errors.gcreddy.For QTP Scripts & Other Information visit: www.COM 12 . step over and step out commands for debugging.

For QTP Scripts & Other Information visit: Through Debug viewer user can watch variables and change values of variables temporarily. library files etc). www.COM 13 . Navigation: View menu>debug viewer (for launching and closing) QTP Tool Window-Debug Viewer 5) Missing Resources It can be used for showing missing resources those attached to current test such as (recovery scenarios.GCREDDY.gcreddy.

www. Navigation: view menu> information QTP Tool Window-Information Pane 7) QTP Commands QTP Commands are available in 3 Navigation: View menu >missing resources (for launching and closing) 6) Information This pane shows syntax errors automatically during saving the test.GCREDDY.COM 14 .gcreddy.For QTP Scripts & Other Information visit: www.

GCREDDY. Insert Menu: Through this menu user can inserting check points. Menu options 1. www. Edit Menu: It provides editing options and renaming. export tests in zip format. View menu: Through this menu we can launch and close. Through insert menu user can insert VB Script conditional and loop statements and transaction points (Start and End). missing resources etc.For QTP Scripts & Other Information visit: www. synchronizing points.COM 15 . active screen. Short cut keys (for Some important operations only) File menu: Through file menu user can create. Data Table. information. out put values. Tool Bar options 3. open existing tests. save tests.gcreddy. using this user can generate recordable and nonrecordable scripts. deleting and splitting actions. Debug viewer. In this menu step generator available.

through this option we can create virtual Through insert menu user can create new actions.gcreddy. call existing actions and copy existing actions. Debug Menu: This menu provides debug commands for step by step execution. Through this menu we can check for updates and download or install directly. view options and object identification configuration. Through this menu we can set tool options as well as test pane view options. analog recording and Low level recording. Run options and Run setting options Through this menu we can start normal recording. Through this menu we can contact technical support people and we can send feedback. Through this menu we can create /modify/delete objects information and we can associate repositories. In this menu object spy option available. Through this menu we can insert/remove/break points. Tools Menu: This menu provides Tools settings option. modify and delete recovery scenarios. Help Menu: This menu provides QTP help as well as VB Script help.For QTP Scripts & Other Information visit: www. running and also we run tests. Through this menu we can create.COM 16 . www. Window Menu: This menu provides QTP tool window style settings. Automation Menu: This menu provides Record. through this we can get object’s information.GCREDDY. (Properties and values) In this menu Virtual object option available. Resources Menu: This menu provides object repository and recovery scenarios options. Through this menu we can stop recoding.

COM 17 .gcreddy.For QTP Scripts & Other Information visit: III) QTP Testing Process Planning o o o o o o Analyzing the AUT Automation Test Plan Generation Automation Framework Implementation Generating/Selecting Test cases for Automation Collecting Test Data QTP Tool Settings Configuration Generating Tests o o o Recording Keyword driven methodology Descriptive Programming Enhancing Tests o Inserting Checkpoints o o o o o o Inserting Output values Adding Comments Synchronization Parameterization Inserting Flow Control Statements Calling User defined functions o Generating Steps though Step Generator o Inserting Transaction Points o Regular Expressions Debugging Tests o Debug Commands & Break Points o o o Step by step execution Watching Variables Changing values of variables Running Tests o o o Normal Execution Batch Execution AOM Scripting www.

COM 18 . consider how we can divide these processes into smaller o o Tests Running through framework Scheduled Execution Analyzing Results o o o o QTP Result window Defining our own Results Exporting Results Deleting Results Reporting Defects o o o Manual Defect Reporting Tool based Defect Reporting Working with Quality Center Analyzing the AUT Before we begin creating a test.gcreddy. To do this. or . www.For QTP Scripts & Other Information visit: www. modular actions helps make our tests easier to read. such as Web. Creating small. Then determine the functionality that we want to test. Java. and maintain. First. try to keep the amount of steps we plan to include in each action to a minimum.NET. determine the development environments in which our application controls were developed. follow. Which objects and operations are relevant for the set of business processes that need to be tested? Which operations require customized keywords to provide additional functionality? While we are thinking about the business processes we want to test. which will be represented by our test's actions. consider the various activities that customers perform in our application to accomplish specific tasks. Each action should emulate an activity that a customer might perform when using your application.GCREDDY. we need to analyze our application and determine our testing needs. so that we can load the required QuickTest addins. As we plan.

paints etc. The Track file is not editable. Record and Run Test on any open window based applications 2. Simultaneously it stores objects information into object repository. Analog Recording: It records the exact mouse and keyboard operations. 4. 6. Record and Run only on If we select first option it records on any opened application on Desktop. We can use this mode for recording continuous mouse operations.gcreddy. Navigation: Automation>Record Or Select Record option on automation toolbar Or Use short cut key (F3) Steps for preparing a Test (through Recording): 1.) 5. During recording QTP generates VbScript statements in Test Pane.For QTP Scripts & Other Information visit: www. 7. After Providing the path it records only on that particular application.COM 19 . If we select Second option. Click OK Perform actions on AUT Stop recording. generates total user actions in a Track File. 3. 8. it asks for the path of the AUT. Navigation: 1. It is not useful for recording normal operations why because it does not generate steps for each operation. 1. Automation >Analog Recording OR www. Keep tool under recording mode 2. 2. Recording and Running: In QTP there are 3 recording modes available for preparing Tests. Select type of Environment (Windows or Web) Select Record Option (It shows two Options : 1. but unable to record continuous mouse operations like Digital Signatures. Save the Test 2. Normal Recording It records User Mouse and Keyboard operations on AUT with respect to objects. Put AUT in base state Select Record Option It shows Record and Run Settings.

Record relative to the following window If we select first option QTP records User operations with respect to Desktop coordinates. Navigation: 1. Record relative to the screen 2.For QTP Scripts & Other Information visit: www. 4.gcreddy. Use Low Level Recording for recording in an environment not recognized by QTP. we have to show the window (AUT).COM 20 . 1. This mode records at the object level and records all run time objects as window or winobject Test objects. Stop Recording Use Short cut Key (Shift + ALT+F3) Steps for preparing a TEST (through Analog Recording): 1. 2. 6. after showing the Window it records with respect to that window co-ordinates.GCREDDY. Keep tool under recording mode 2. Select any one option in the dialog box and click Start Analog record. 3. 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 www. Low Level Recording It records some operations on Non-supported environments apart from Normal operations. If we select Second option. It records User actions 7. Launch AUT (or we can launch AUT through QTP) Select Record option Automation>Analog Recording Analog Recording Settings Dialog box opens (In this Dialog box two options available.) 5.

Ex: Run time objects Test objects in Test objects in VB windows Environment Environment buttons WinButton VBButton Edit box WinEdit VBEdit Check box Wincheckbox Vbcheckbox Test objects in web Environment WebButton WebEdit Webcheckbox Utility objects They are QTP reserved objects used for testing and result reporting. WebButton. Ex: Buttons.. Run time objects: The objects present in the AUT.COM 21 . Run time objects Test objects Utility objects Automation objects/User defined objects. 4. as software objects. www. SystemUtil for launching/closing the application. 3. Ex: WinEdit. Reporter for defining results. edit Object Repository Object Repository: It is a storage place of QTP where we can store the objects information and it also acts as interface between the test script and the AUT in order to identify the objects during execution. Object: Object is something. 2.For QTP Scripts & Other Information visit: www. WinButton. 2. WebPages. buttons. 1. which has structure and properties.gcreddy. links. Link.GCREDDY. Types of Object in QTP: There are four types of object available in QTP. Software objects: We call windows. etc… Note: Test objects names vary from one environment to another. etc… Test Objects: References of Run time objects. check boxes etc. Ex: 1.

COM 22 .TSR extension) Local Repository: QTP creates a Local Repository for every action automatically during Recording. Services for inserting transaction points 4.connection class. There are two types of repository available in QTP. Shared repository(. User can add some more objects to Local repository User can perform rename. That cannot be shared among tests. Local repository (.GCREDDY. adodb. excel. 1. Ex: Creating objects in file system object class. dictionary object class. those can be used for performing specific 3.MTR extension) 2. Navigation: Resource menu>object repository (Short cut key Ctrl+R) www. Environment for using environment variables Automation objects/User defined objects User can create objects.gcreddy.For QTP Scripts & Other Information visit: www. delete operations in local repository. Application class etc. As it is QTP internal file user no need to save modifications.

Local Repository Shared Repository: User (Test Engineer) creates shared repository by adding objects.GCREDDY. Local Repository: Navigation: open local repository (resource menu>object repository) >objects>Add objects to Local>show the object>click ok (No need to save separately.For QTP Scripts & Other Information visit: www. it saves automatically) B. That can be shared among number of QTP.COM 23 . Using this method user can perform modifications on objects easily. Operations on Object Repository Adding objects a.gcreddy. Shared Repository: Navigation: Resource menu>object repository manager>object>Add objects>show the window/object>click ok www.

GCREDDY.>close repository b. Shared Repository: Resources >object repository manager>file>open>browse path of the repository file >file>enable editing>select object &Right click>choose rename option>modify the name > release mouse>save the file & close repository manager. Shared Repository: Resources >object repository manager>file>open>browse path of the repository file >file>enable editing>select object &Right click>choose delete option>confirm the deletion >save the file & close repository manager.) Renaming objects a. Note: After merging also. if we select second option it stores all default objects. Local Repository: Resources > object repository >select object and right click >choose delete option >confirm deletion>. we can select more than one class also.For QTP Scripts & Other Information visit: www. Deleting objects a. Associating objects repositories to an action Resources>Associate repositories>click add icon (+)>browse path of the repository>Associate with an action>click ok Merging Repositories Resources > object repository manager>tools>object repository merge tool >browse path of the first repository> browse path of the second repository>click ok>click close>save the merged repository>close the repository manager. www.gcreddy. >close repository b. if we do not want source files we can o o o o Selected object only Default object types All objects types Selected object types (If we select first option it stores Selected objects only. if we select third option it stores All objects including static objects. we have to select object classes then it stores that class objects. source repository files will be available. Local Repository: Resources > object repository >select object and right click >choose rename option >modify the name>release the mouse. if we select fourth option.COM 24 .

GCREDDY.gcreddy. Navigation: Select object in the repository >view>highlight in application>it highlights specified objects in the application. Spying objects For getting objects information. Exporting Repository to an XML file We can export our repository file to an xml file. (Test objects names. In tools Menu 2. Navigation: File >export Test objects to XML Enter the file name and Save with xml extension. Note: The purpose of this feature is Editing objects information outside of the QTP www. In local repository 3. Importing Repository from XML file. Highlight in Application This feature can be used for identifying objects from repository to application.For QTP Scripts & Other Information visit: www.COM 25 . Navigation>Tools>object spy>take hand icon & Show the object>get information (Object Spy shows the specific objects all available properties with their values) Note: As Object spy is an important feature. Navigation: File>import from XML >browse path of the XML file >it loads objects. property & Values) QTP is providing a feature called Object Defining new test objects Navigation: Object>Define new test object >Select Environment>Select Class of the object>Enter name of the object>Click Add>click close>Select object >select property name>enter value (like this select one by one properties and enter values)>save Note: This feature can be used for preparing tests before the AUT is ready. Navigation: View>Locate in repository >show the object>click Ok>it locates specified object in the repository. In Repository manager) View Options Locate in Repository This feature can be used for identifying objects from application to repository.(1. it can be available in 3 Areas. using this we can get objects information. We can import XML file to our repository.

click Close Method: It closes the window.Close Browser(“Browser”). Selecting a Radio Button Syntax: Object Hierarchy. Activate Ex: Dialog(“Login”).WinCheckBox("Order No.COM 26 . Set Ex: Window("Flight Reservation"). Dialog("Open Order").Set c.Set “ON/off” Ex: Window ("Flight Reservation").For QTP Scripts & Other Information visit: www.gcreddy. Selecting/Deselecting check boxes Syntax:object Hierarchy. Click Ex: Dialog(“Login”).Winbutton(“ok”).Activate Click Method: It clicks on an object (Buttons) Syntax: Object hierarchy.WinEdit(“Agent Name”). For setting the value of an edit box Syntax: Object Hierarchy.GCREDDY. Set Method: It can be used in three ways.").Set "ON" Select Method: It is used for selecting an item from a combo box or list box. Close Ex: Window(“Flight Reservation”). Browser window etc.Close DBL CLICK: It Double clicks the object.WinRadioButton("Business").Activate Window(“Flight Reservation”). a. Syntax: Object hierarchy.Dialog box. SET “Value” Ex: Dialog (“Login”).select “item” Ex: Methods Activate: It activates dialog boxes/Windows Syntax: Object hierarchy. Syntax: Object hierarchy.Set “asdf” b.

WinList("From").exist(time in seconds) Ex: Window("Flight Reservation").For QTP Scripts & Other Information visit: www. any property value.COM 27 .co.Select "London" B. Syntax: Object hierarchy. Window("Flight Reservation").Dialog("Flights Table"). It can be used for getting any object’s.WinComboBox("Fly From:").GetVisibleText msgbox x GetRoproperty: It returns current object property value.GetContent Ex: x=Window("Flight Reservation"). Syntax: object hierarchy.WinEdit("Tickets:").com A.getroproperty (“property name”) Ex: x=Window("Flight Reservation"). Window("Flight Reservation"). Syntax: variable=object "http://www.Select "12572 GetVisibletext: It returns Text from the specified area.GetItemsCount msgbox x Getcontent: It returns all items from a combobox.GetROProperty ("width") msgbox x Navigate Method: It opens a specified URL in the Browser.navigate “URL” Ex: Browser("Yahoo!"). Syntax: Variable = object hierarchy.gcreddy.getvisibletext Ex: x=Window("Flight Reservation"). Syntax: Variable=object hierarchy.GetContent msgbox x Exist property: It checks whether the object is available or not.WinComboBox("Fly From:").WinComboBox("Fly From:").Exist(5) www.GCREDDY. Syntax: Variable =object hierarchy.getitemscount Ex: x=Window("Flight Reservation").in" Getitemscount: It returns number of items in a combobox.WinComboBox("Fly From:").

Click . Password:. text.Create www. OK . Login. Descriptive programming is basically 2 types.GCREDDY.Create oPassword=description. Creating Properties Collection Objects Set Set Set Set oLogin=description. This feature is available in Tools Menu.Property values or Logical Names of the Object 4.Property names 3.Methods Note2: If we feel one property information is not sufficient for recognizing the object uniquely. Agent Name:.Winbutton("text:=OK". then we can provide more properties information by separating with commas.Click Note: Descriptive Programming/Programming Descriptions Providing objects information directly into the test script is called Descriptive Programming.COM 28 . we provide objects information directly into the script. Set. provide properties information and use description objects in the test script. we can use object spy feature.Activate dialog("text:=Login").gcreddy. first we create description objects.Set "asdf" dialog("text:=Login"). attached text .Create oAgent=description.For QTP Scripts & Other Information visit: www.Create oOk=description.Winedit("attached text:=Agent Name:"). Static Programming 2. 1. Dialog. Setsecure. Dynamic Programming: In this style of script generation.Set "mercury" dialog("text:=Login"). Note 3: If we want to get objects information (Test objects. Ex: Invokeapplication "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a. Activate.exe" dialog("text:=Login"). in local repository and in repository manager. properties and values).Winedit("attached text:=Password:"). These scripts can be executed faster than repository based scripts. Dynamic Programming Static Programming: In this style of script generation. WinEdit and WinButton – Test Objects 2."width:=60").

we can generate tests. by associating that library file. Inserting Output Values 3.Click Note1: Create Description objects and put into one library file.value="Agent Name:" oPassword("attached text").com Entering Properties Information into Objects oLogin("text"). 1.Set "mercury" Dialog(oLogin).value="OK" Generating Tests using Properties collection Objects Invokeapplication "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a. There are several methods available in QTP for enhancing the TEST.GCREDDY. Inserting Check Points 2. Inserting Flow Control Statements 5.value=204 oAgent("attached text"). Parameterization 7. Enhancing Tests After generating the basic test.gcreddy.Winedit(oAgent). Standard check point www. Adding Comments 4.value="Password:" oOk("text").For QTP Scripts & Other Information visit: www.value="Login" oLogin("width"). Generating Steps through Step Generator 8. Note2: Dynamic programming is some difficult in preparation than static programming but maintenance is very easy. There are 11 check points available in QTP: 1.COM 29 .Set "asdf" Dialog(oLogin).value=320 oLogin("height").exe" Dialog(oLogin). Inserting Transaction Points:(Start and End) Inserting Check Points: Check point is a verification point. it takes expected result from the user and compares with actual results during execution and provides test results.Winbutton(oOK).Winedit(oPassword). Synchronization 6.Activate Dialog(oLogin). we have to enhance the test in order to Test the AUT with respect to requirements.

2. 10.gcreddy. 2. 7. we can insert these checkpoints through standard checkpoint. Navigation 2 (editing standard checkpoint) Select checkpoint statement and right click >choose checkpoint properties option>modify the value>click ok. Navigation: keep tool under recording mode>Insert check point>text checkpoint>Show the object >click ok>Select options www. Through Active screen. Inserting Standard check points through active screen: View>Active Screen>place cursor in desired location>Place mouse pointer on active screen&right click>choose insert standard checkpoint option>click ok>enter expected result>click ok Note: Inserting Standard check points through keyword view same as in expert view. 8. 9. Note 2: From 9 to 11 checkpoints are hidden checkpoints. Through expert view.GCREDDY. Through keyword view. We can use this checkpoint for checking any property value. 1. 1. Navigation1(Inserting standard checkpoint) : Keep tool under recording mode>place cursor in desired location>Insert arrow check point>Standard checkpoint>Show the object (which is result window)>click okay>select property and enter expected results&click ok and stop recording. 4. Text check point Text area check point Bit map check point Data base check point Accessibility check point XML Check point (from application) XML Check point (from resource) Page check point Image checkpoint Table checkpoint Note 1: From 6 to 11 checkpoints are only for Web. 3.COM 30 . Text Checkpoint: It checks object’s text property value in different ways. Note: We can insert standard checkpoints in 3 ways. 2. 3. 5. Navigation 3 (Deleting standard checkpoint) Select checkpoint statements and right click>choose delete option.For QTP Scripts & Other Information visit: www. Standard Checkpoint: It checks object property values. 11.

GCREDDY. Text Area Checkpoint: It checks the text area present in the application. It is a configurable checkpoint. 1. Navigation: Insert>checkpoint>database checkpoint>choose “specify SQL statement manually”option>click next >click create>select machine data source>Select DSN(QT_flight32)>click ok>enter SQL statement (select * from orders)>finish>click ok. text not displayed. Navigation: Keep tool under recoring mode in web environment>insert >checkpoint (from application)>show the xml pages>click ok>stop recording. we can compare complete bit maps as well as part of the bit maps. Result Criteria: 1. Bitmap checkpoint: It compares bit maps. Note: here we do not need to put on recording mode and we do need AUT since data is from backend. Navigation: Keep tool under recording mode>insert >checkpoint>bitmap checkpoint>show the bitmap>click ok>select “check only selected area” option if we want to compare part of the bitmap>click ok>stop recording. 4.COM 31 . Accessibility check point: It checks whether the webpage in our web application is developed according to W3C (world wide web consortium) rules and regulations or not. If an item is not available then result would be pass 7. according to our requirements.) We can select one or more options>click ok & stop recording. exact match. 5. ignore spaces. Database checkpoint: It checks Content of the back end database. (Match case.XML Check point (from application) It checks content of the XML file. Navigation: Keep tool under recording mode >Insert arrow checkpoint>Text area checkpoint>Mark the area of text >select one or more options (Match case. 2. we can customize. If an item is available. ignore spaces.) Click ok and stop recording. according to W3C rules then Pass. 3. exact match.gcreddy. text not displayed.For QTP Scripts & Other Information visit: www. Configuring accessibility checkpoint: Tools>options>web>adavanced>check/uncheck items >click apply>click ok Navigination: Keep tool under recording mode with web environment >insert>checkpoint>accessibility checkpoint>show the webpage>click ok>click ok>stop recording. If item is available but not according to W3C rules then fail. www.

GCREDDY. we can insert this through standard checkpoint. It is stored in run time data table. Navigation: Insert>checkpoint>xml checkpoint (from resource)>browse path of the XML File >click ok>click ok. XML Check point (from resource) It checks content of the XML file. Note: 2. If XML file is an individual and path available. Navigation: Keep tool under recording mode with web environment >insert>checkpoint>Standard checkpoint>show the page>click ok>click ok>stop recording. images available in a web page. Page checkpoint: It checks number of links. 2. Note: 1. then we can go for inserting xml checkpoint from 9. 11. Table checkpoint: It checks content of the web tables.gcreddy. 3. The values can later be used as input at a different point in the run session or we can use as input for another test. Navigation: keep recording mode with web environment >insert>checkpoint>standardcheckpoint>show the image>select image>click ok>click ok>stop recording. 5. Inserting Output Values: It is a step in which one or more values are captured during execution. Standard output value Text output value Text area output value Database output value XML output value (From Application) XML output value (From Resource) www. 12. 10. separte path is not available then we can choose inserting XML checkpoints from application. it is located in QTP result window and can be retrieved later. Image checkpoint: It checks Image property values. Types of Output Values: 1. It is a hidden checkpoint. Navigation: Keep tool under recording mode under web environment>insert>checkpoint>standard checkpoint>show the table>click ok >stop recording.For QTP Scripts & Other Information visit: www. 6. 4. If XML file is part of web application.COM 32 .

Navigation: Keep tool under recording mode with web environment>Insert>output value>XML output value from application>Show the XML document>select elements>click ok>stop recording. B. Standard output value: We can use standard output values to output the properties values of most objects. Navigation: Keep tool under recording mode >Insert >output value>standard output value>show the object>click ok>select property>modify the column name (if required)>click ok>click ok>stop recording. F. Navigation: keep tool under recording mode>insert>outputvalue>text area output value>Mark the text area>click modify the column name if necessary>click ok>again click ok>check in run time table after running it. Navigation: Insert>outputvalue>Database output value>choose specify SQL statements manually>click next>click create>Select Machine Data source>Select Driver (QT_flight32)>click ok>enter SQL statement(select *from orders)>click finish>select datacells>click ok>Run and it will capture and see the results in run time table. Navigation: Keep tool under recording mode>Insert>output value>text output value>show the text>select one of the option(output text/text before/text after)>click modify if you want to change the column name>click ok>click A. XML output value(from application): we can use XML output values to output the values of XML elements in XML documents. Navigation: Insert>output value>XML output value from resource>browse path of the XML file >click ok>select elements>click ok. E. C.>check in runtime table after running it. Text Area output value: We can use text area output values to output text strings displayed within a defined area of the screen. Database output value: We can use Database output values to output the value of the contents of database cells.gcreddy.For QTP Scripts & Other Information visit: www.COM 33 . D. When creating a text output value we can output a part of the objects text and we can also specify text before and after options. Text output value: We can use Text output values to output text strings displayed in an application..GCREDDY. Adding Comments: Purpose of Comments: o For making the script understandable o For making the Script Disable from execution www. XML output Value (From Resource) we can use XML output values to output the values of XML elements in XML documents.

that time we may not get proper execution and Syntax: 1.COM 34 .For QTP Scripts & Other Information visit: www. Inserting Wait statements. but AUT takes less time for some operations execution and more time for some operations execution. There are several methods available in QTP for synchronization. 2. Increasing Tool default synchronization time. Sync Method (Only for WEB) Inserting Wait Statements: We can insert wait statements in our test in order to make QTP to wait until AUT completes current operation. Synchronization It is a process of matching the speeds of both QTP and AUT in order to get proper execution and results. Use shortcut key ctrl+shift+M Inserting Flow Control Statements: QTP adapted Vbscript engine for applying programming logic to tests. Syntax: Wait(time in seconds) Note: If we insert wait statements QTP waits up to maximum time even though operation is completed. 4. Where Synchronization is required: During test execution QTP gives instructions one by one with same speed. 3. Use REM Command with single space before the statement Comment a Block of Statements: Navigation: Select block of statements >edit menu>advanced>comment block Or After selecting block of statements use shortcut key Ctrl+M Uncomment a block of statements: Navigation: Select comment block>Edit menu> Advanced>Uncomment block Or After selecting comment block. In order to get proper results in between QTP & AUT synchronization is required.GCREDDY. 1. Inserting Synchronization points. We can insert Vbscript conditional statements and loop statements for applying the logic. Use Apostrophe (‘) before the statement 2.gcreddy. Inserting Synchronization point: www. In Vbscript there are 2 types of conditional statements and four types of loop statements available.

Suppose in our test more statements are taking more time for execution then selecting “increasing tool time out” .Sync Selecting an appropriate Method: 1. After completion of one statement execution it goes to next statement immediately. Above two are local features but wait statement is Vbscript feature. after completion of the current operations. even though some drawbacks are there in using wait statement. 3.StartTransaction "name of transaction" ------statements ---------------services.Page("Yahoo! Toolbar"). Inserting Transaction Points:(Start and End) We can insert Transaction points for measuring Transaction time.EndTransaction "name of the transaction" Note: We can insert multiple transactions points in a test. Note: if we insert Synchronization points. www. it does not wait up to maximum time. it goes to next step immediately.value. Syntax: object hierarchy.gcreddy. it is better to use wait statement in functions. Suppose in our test one or more statements only are taking more time for execution then selecting “Inserting synchronization method” is better.waitproperty “property name”. Place cursor in desired location>keep tool under recording mode>Insert menu>Synchronization point >show the object >click ok>select property name & Value(True)>enter time in Milli seconds>click ok>Stop recording.COM 35 . Increasing Tool default synchronization time: Navigation: File>settings>run tab>increase object synchronization time out>apply>ok Note: If we increase QTP tool default time that can be applied for all statements in the test.Sync Ex: Browser("Yahoo! Toolbar").For QTP Scripts & Other Information visit: www.GCREDDY.time in milli seconds. but QTP does not wait up to maximum time unnecessarily. Syntax: Object Hirearchy. It is a performance concept but QTP supports measuring transaction time per user only. Syntax: Services. Sync Method: (only for WEB) Waits for the browser to complete current navigation.

1.Set "ON" Window("Flight Reservation"). Types of Parameterization: We can parameterize tests in several ways. we can use Data Table for Data Driven Testing.exe" Dialog("Login"). Getting Test Data from front end objects. We use parameterization in Data Driven Testing.Click Window("Flight Reservation").WinEdit("Agent Name:").Close Next 3.Dynamic Test Data Submission: Through Loop Statements we can give strings also but every time user has to enter data. Data Driven Testing: Testing the Same operation with multiple sets of test data.WinButton("OK"). 6.WinCheckBox("Order No. Through Data Table: QTP adds one data table (Spreadsheet) for every test.Activate Window("Flight Reservation"). 2. www.WinEdit("Edit"). Note: We can’t generate Strings.WinButton("OK").Dialog("Open Order").Set Agent Dialog("Login").Dialog("Open Order").Click Window("Flight Reservation").Type micTab Dialog("Login"). 5.Dialog("Open Order"). 4.WinEdit("Agent Name:").gcreddy. through this concept we can pass multiple values.Activate Dialog("Login").SetSecure password Dialog("Login").Click Next 2. 3. For x=1 to 3 Agent =inputbox("enter an Agent Name") Password=inputbox("enter a password") invokeapplication "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.WinButton("Button").").GCREDDY. Through Loop Statements Dynamic Test Data Submission Through Data Table Fetching Test Data directly from External files (Flat files & Spreadsheets) Fetching Test Data directly from Databases (MSAcess.WinEdit("Password:"). Through Loop Statements: We can use loop statements for passing sequential numbers & Logical Numbers.Set orderno Window("Flight Reservation"). oracle etc).com Parameterization Passing parameters. For orderno=1 to 10 step 1 ' for one increment step keyword is not mandatory Window("Flight Reservation").COM 36 .For QTP Scripts & Other Information visit: www. 1.

Steps: Generate the basic test>open data table(View>Data Table) Click on column header>enter the name of the field (like this we can create number of columns) > Enter Data>connect the data to test (variable=datatable(“column name”. A. d. but first we have to create /get the DSN(Data source Name)& we have to use SQL Commands. Importing test data from external Spread sheets: Open Data Table (view>Data table)>place mouse pointer on data table and right click>file>import from file>Click ok>Browse path of the excel sheet (it imports data from the excel sheet) Connecting Test Data to QTP Test as above and run the test. Sheet id) Example: agent=datatable(“agent”.1) Pass parameters.COM 37 .exe" Dialog("Login"). b.SetSecure pwd Dialog("Login").Click Window("Flight Reservation"). It has 3 types of usage . Entering test data directly into data table and use. Entering test data directly into data table and use Importing test data from external Flat files Importing test data from external Spread sheets Importing test data from Data bases.gcreddy. Agent = Datatable("Agent".1) pwd=Datatable ("Password". D.For QTP Scripts & Other Information visit: www. a.) Run the test.WinEdit("Agent Name:").WinButton("OK").Activate Dialog("Login"). c.GCREDDY. c.WinEdit("Agent Name:").Set Agent Dialog("Login"). Importing test data from external files: Open Data Table (view>Data table)>place mouse pointer on data table and right click>file>import from file>Click ok>Browsw path of the file(it imports data from the flat file) Connecting Test Data to QTP Test as above and run the test.WinEdit("Password:").Close b.1) invokeapplication "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.Type micTab Dialog("Login"). Importing test data from Data bases: Through Data table we can import Test Data from Data bases.

gcreddy.filesystemobject") Set myfile=fso.WinEdit("Agent Name:").atendofline <> true x=myfile.Type micTab Dialog("Login")."". Creating a Test Database: open MS Access (or we can use any other database).txt".skipline While myfile. by using the DSN we can get data for number of tests.SetSecure S(1) Dialog("Login"). Creating DSN & importing data Navigation: view>data table>Place mouse pointer on Data table>sheet>import>from database(Database query wizard opens)>choose ‘specify SQL statements manually>click next >click create>click new>select driver type>click next >browse path to store> enter DSN Name>Click Save>click next>click finish>select>browse the database& select>click ok>click ok>select DSN>click ok>enter SQL statement (select *from login)>click finish. Entering Data into Tables: Select table>enter the data.opentextfile("d:\trigun."@") SystemUtil.WinEdit("Agent Name:")."open" Dialog("Login").exe".GCREDDY.Close Wend Fetching Test Data directly from Excel Sheets Fetching Test Data directly from Databases option explicit Dim con.Set s(0) Dialog("Login"). 4.WinEdit("Password:").WinEdit("Password:").com 1.readline S=split(x. Start programs>MS Office>MS Access>file >new>Select blank Database>enter name of the database>Save with mdb extension.1) myfile."C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\". Creating Tables: Select Create table in design view>Enter field name(Agent)and Select data type(text) Like this we can create number of fields>save&enter table name. Note: DSN Creation is one time activity. myfile Set fso=createobject("scripting.COM 38 .Activate Dialog("Login").rs Set con=createobject("adodb. Fetching Test Data directly from Flat files Dim fso.connection") www.Type micReturn Window("Flight Reservation").For QTP Scripts & Other Information visit: www.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.

COM 39 ."C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\". Ex: Dim a.GCREDDY. Step Over (Short cut key F10) e.c a=100 b=200 c=a+b msgbox c msgbox "hello" www.recordset") con.Type micTab Dialog("Login").Close rs. It starts execution b. Step Out (shift +F11) It executes all remaining statements in a function at a time.jet.gcreddy.oledb. If it is function Set rs=createobject("adodb.fields("password") Dialog("Login"). after that it executes one statement at a time.WinEdit("Agent Name:").Set rs. It executes one statement at a time after execution starts f.provider=("microsoft.For QTP Scripts & Other Information visit: www.mdb" rs.WinEdit("Password:").4. it opens the function.exe". It executes one statement at a "C:\Documents and Settings\pooja\My Documents\trigun. Debug Commands: 1.eof=true SystemUtil.Type micReturn Window("Flight Reservation"). QTP is providing debug commands and breakpoints."open" Dialog("Login").Activate Dialog("Login"). It executes all functions statements at a time Note: After opening the function.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\ "select * from login".movenext loop Debugging the TEST Debugging is a process of executing the script or a program in a User designed fashion with some temporary break points in order to identify the errors.0") con.WinEdit("Password:").SetSecure rs."".fields ("agent") Dialog("Login"). 3. Step Into: (short cut key F11) a.con do until rs. if we use step over it executes one statement at a time only.WinEdit("Agent Name:"). 2. c. For debugging.

gcreddy. We can watch variables whether the variables are taking correct values or not at a specific point of time.For QTP Scripts & Other Information visit: www. Command Note: Through Debug Viewer Pane. modifying or setting the value of the variables during the execution break with the help of 3 Tabs. Watch 2. www. Note: If we want to execute Some part of the Test Script at a time and some other part of the test script step by step.COM 40 . Debug viewer Pane: It is used for Call hyderabad msgbox "bye bye" Note: Create a script and work on it Break Point: This feature is used for breaking the execution temporarily. there we can use breakpoints. We can change Values of Variables temporarily. 1.GCREDDY. Ex : Dim x.y. Variables 3.z x=10 y=20 z=x+y msgbox z msgbox "Hello" x=35 y=67 z=x*y msgbox z msgbox "bye bye" Navigation: debug viewer>Use step into feature. Navigation: Place cursor in desired location >Debug menu>Insert/Remove break point Or Use short cut key (F9) Or Place mouse pointer before the statement and click.

COM 41 . Java script or VC++. For performing batch execution QTP is providing a separate tool called test batch runner. methods and properties that enable us to control QTP from another Running the Test / Executing the Test 1. . Executing a TEST Batch. Execute Test batches from Test batch runner. www. Forming a Test Batch: Launch Test batch runner. Open Test Batch Runner Tool Navigation: File>open>browse path of the test batch>batch>run Note: Test batch runner launches QTP Tool. Prepare individual tests and run once. QTP runs Tests one by one.GCREDDY. QTP automation object model provides objects. 3.Net for automating QTP operations.For QTP Scripts & Other Information visit: www. Steps for batch testing: 1. AOM Scripting (Automation Object Model) We can use QTP automation object Model to write scripts that automate our QTP operations. Open Test batch runner tool and form batches.gcreddy. Normal execution/ General execution (Executing one test at a time) 2. Batch execution/Batch Testing Executing a group of tests at a time is known as batch execution. Navigation: Start>program>quicktest professional>Tools>Test Batch Runner>File>new>batch>add>browse path of the test (like this add number of tests)>save with MTB extension (Module test batche)>close test batch runner. Note: Allowing other products to run tests. We have to view Test wise results through Test Result viewer. We can use Scripting languages or programming languages such as VBscript. Navigation: Tools>Options>Run>check allow other mercury products>apply & Ok Executing partial Test Batch Open Test Batch runner >open Test Batch>Select or deselect tests>run test batch. Note: QTP does not provide Batch wise test results. 2. 3.

Scheduled execution Navigation: Start>Settings >control panel>Select on scheduled tasks>Click add scheduled task>click next>Select Application as quick test professional>Click next>Type name of the task AOM. Result Reporting : From QTP result window.visible=True qtApp.For QTP Scripts & Other Information visit: www. 4. Executing Tests through Framework 5. QtApp is variable.Vbs>select the schedule>click next>enter time and date>click next>enter system name and password if required>click next>click Finish.quit Notes: Set is for statement. "C:\Documents and Settings\admin\My Documents\login" Set qtTest=qtApp.Launch qtApp. Test result viewer: QTP is providing Test Result Viewer for viewing and exporting test results.Test qtTest. Or Click result icon on Automation tool bar> B. Navigation: Start>Programs>Quick Test Professional>Test Result Viewer>File >open>Browse path of the test>Select Result>click "C:\Documents and Settings\admin\My Documents\open order" Set qtTest=qtApp.close qtApp.close Ex: option explicit Dim qtApp.Test qtTest. 6. Deleting Test Results: For Deleting test results QTP is providing a separate Tool called Test Result Deletion Tool.qtTest Set qtApp=createobject ("quicktest. Createobject is for qtTest. Or From QTP Tool window: Automation menu>results>browse path of the test> Select Result>click open. Analyzing the results: a.application” is used for class value Launch is used for method.application") qtApp. www.GCREDDY. Navigation: Start programs>quick test professional>Tools>Test result Deletion tool>browse path of the test>Select result>click Delete>click close.COM 42 . “quicktest.gcreddy.

com Navigation: File >export to HTML file>click export>browse path of the location>save. We can send defects directly from QTP result window.GCREDDY.0 . QC (Quality Center) QTP Actions Other QTP Features We divide our test into actions to streamline the process of testing. Purpose of Actions: For understandability For reusing components Types of Actions: Non Re usable actions Re usable actions External actions Operations on actions: • • • Creating Actions Splitting Actions Renaming Actions www. etc. QTP Any Tool like BugZilla or issue –Tracker or PR – Tracker. open the TOOL. enter defect details and send After analyzing the results. XML & PDF formats also available. Apart from HTML format DOC. open the defect reporting template. Note: In QTP 10.gcreddy.For QTP Scripts & Other Information visit: www.COM 43 . Reporting Defects Functional Automation QTP Defect Management Manual Tasks After analyzing the results. enter defect results and send In between QTP & QC back to back integration. open company prescribed defect report template.

Split into meaningful actions. Making an action reusable: Select Non Reusable action >edit >action>action properties>check reusable action check box >click ok. Calling an action: Insert>call to existing action>browse path of the test>select desired action>click ok. Note: U can’t edit F.gcreddy.For QTP Scripts & Other Information visit: www.COM 44 . Note: At a time we can split one actions into 2 actions. C. B. G. Deleting Actions: Select desired action in action drop down box>edit menu>action>delete action>confirm deletion. Create required actions(ex login.GCREDDY. Renaming actions: Select desired action in action drop down box> edit menu>action>rename action>modify the name>click ok. Copying an action: Insert>call to copy of action>browse path of the test>select desired action>click ok. Generate total test in the default action 2. D.delte) 2. Prepare Scripts for those actions. Note: we can edit this action. insert. Regular Expressions www. Splitting an action: Navigation: Place cursor in desired location>Edit menu>action>split action>Enter Action 1 name & action 2 name. E. Steps: • • • • Deleting Actions Calling an Action Copying an Action Making an Action Reusable/Non Reusable Creating an action: Insert>call to new action>enter name of the action>click ok Steps: 1.

Navigation: Open object repository >select the object>select the property value>click configure>check regular expression >enter expression [0-9] close repository. [a-z] 4.Activate dialog("text:=Login"). Function procedures A.Winedit("attached text:=Password:"). Sub procedures 2.Winedit("attached text:=Agent Name:"). we use these for reusing components. [A-Z] [a-z] we can also use two expressions together [0-9] for one to 9 digits this is how we use [0-9]*for 2 digit numbers to be considered. 2.For QTP Scripts & Other Information visit: We use regular expressions whenever object’s properties values are changing dynamically.vbs file Ex: Sub login Invokeapplication "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.c) Creating a Sub procedure Open an editor (notepad) Prepare test script Save as Dot. We can give number of arguments by separating with commas.GCREDDY.Set "mercury" Name of the procedure(arguments) www. Always-regular expression we use brackets.gcreddy. 1. For example use fax order Functions: Functions are Vbscript features. Sub Procedures: Sub procedure performs a task(s) but cannot return a value.Set "asdf" dialog("text:=Login"). Vbscript Procedures: In Vbscript there are 2 kinds of procedures available.b.exe" dialog("text:=Login"). Note: 1.COM 45 . [A-Z] 3. Syntax: SUB Statements End Sub Note: Arguments are optional . Ex: (a.

If we declare as local variables in number of tests.200.Winbutton("text:=OK". modifications are difficult.COM 46 .com dialog("text:=Login").300) msgbox x Environment Variables These are global variables. We can create as many files as we want and we can change values of variables. User defined variables: Variables that we predefine in the active external environment variables file.For QTP Scripts & Other Information visit: www."width:=60"). we can access from all tests but these are designed as read only.GCREDDY. Types of Environment variables: 1. if you want to use some variables globally (From number of tests) declaring as global variables is better.c) res=(a+b+c) trigun=res End Function x=trigun(100.gcreddy.Click End Sub Associating a procedure to QTP.vbs” Calling a procedure: Call procedure name (ex Call login) Function Procedure (it returns a value) Function trigun(a. Navigation: File >settings>Resources>Click add icon>browse path of the library file>click apply>click ok Or Executefile “path of the library file” C:\Documents and Settings\pooja\Desktop/login.b. 2. Usage of environment variables: Syntax: Variable = Environment(“environment variable name”) Ex: X=Environment (“ActionName”) Msgbox x Example Script: www. Built in variables: These are system defined variables.

Run ProductDir & app Dialog("Login"). Or We can load environment file directly Environment. Navigation: Tools>virtual objects>virtual object manager>click new>click next>select class(ex button)>click next>click mark object>mark the area on AUT>click next>click next>enter collection name or project name>click finish>click close. Associating environment variable file: Navigation: file >settings>environment >select variable type as user defined>check “load variables and values from the external file”> browse path of the xml file >click apply & ok.WinEdit("Agent Name:").COM 47 .gcreddy. Virtual object configuration It is a process of making the QTP to treat a specified area or an user defined object as a specific object.>click ok.Click Creating user defined environment variables: Navigation: File>settings>environment>select variable type as user defined>click add icon (+)>enter variable name & Value>click ok (like this we can create number of variables)>click export >browse path & enter file name.SetSecure "4b3c86f2107ff565cc195ba6c24739091b656407" Dialog("Login").For QTP Scripts & Other Information visit: www.Set "kajal" Dialog("Login").WinEdit("Password:").loadfromfile”path of the xml file” Usage of user defined environment variables: Associate environment file to current test: Variable = Environment (“Variable Name”) X=environment (“city”) Msgbox x Modifying Environment files: Select XML file>open with notepad>modify the values>Save. save with xml extension.exe" Systemutil.WinButton("OK"). ProductDir =environment ("ProductDir") app= "\samples\flight\app\flight4a.Activate Dialog("Login").

GCREDDY. Running/Executing a Test Batch Open Test Batch Runner Tool Navigation: File>open>browse path of the test batch>batch>run Note: Test batch runner launches QTP Tool. Prepare individual tests and run once.For QTP Scripts & Other Information visit: www.gcreddy. Open Test batch runner tool and form batches. Execute Test batches from Test batch runner. Navigation: Tools>Options>Run>check allow other mercury products>apply & Ok Executing partial Test Batch Open Test Batch runner >open Test Batch>Select or deselect tests>run test Note: when you run and click on virtual object you will see as virtual button.Add (RepPath1) www. Dynamic Handling of Object Repositories We can handle the object repositories through scripting with the help of a utility object Repositoriescollection Ex RepPath1= "C:\Documents and Settings\admin\My Documents\Login. Steps for Batch Testing: 4.tsr" Repositoriescollection.COM 48 . For performing batch execution QTP is providing a separate tool called test batch runner. 6. Navigation: Start>program>quicktest professional>Tools>Test Batch Runner>File>new>batch>add>browse path of the test (like this add number of tests)>save with MTB extension (Module test batche)>close test batch runner. Batch Testing or Batch execution Executing a group of tests at a time is known as batch execution.tsr" RepPath2= "C:\Documents and Settings\admin\My Documents\Orders. Note: Allowing other products to run tests. QTP runs Tests one by one. 5. Forming a Test Batch: Launch Test Batch Runner.

WinComboBox("Fly From:").removeall LON www.20" Window("Flight Reservation").Find(RepPath1) Repositoriescollection.WinEdit("Agent Name:").ActiveX("MaskEdBox").WinList("From").Select "20289 09:12 AM DEN 04:23 PM AA $112.Click Window("Flight Reservation").exe" Dialog("Login").Activate Window("Flight Reservation").Add (RepPath2) Window("Flight Reservation").gcreddy.Type "101010" Window("Flight Reservation").Set "asdf" Dialog("Login").Click Window("Flight Reservation").WinEdit("Password:").Add (RepPath1) SystemUtil.WinButton("FLIGHT").Set "mercury" Dialog("Login").com SystemUtil.WinEdit("Name:").WinButton("New").Click Window("Flight Reservation").Dialog("Flights Table").Remove(Pos) Repositoriescollection.add (variable) Note 2: For finding repository position Variable =reposotoirescollection.WinButton("OK").Activate Dialog("Login").Set "asdf" Dialog("Login").RemoveAll Repositoriescollection.GCREDDY.Dialog("Flights Table").WinButton("OK").Activate Window("Flight Reservation").For QTP Scripts & Other Information visit: www.Dialog("Flights Table").WinButton("OK").Add “path of the Repository file”) Or Vairable =”path of the repository file” Reposotoriescollection.Activate Dialog("Login").find (“Path of the repository file”) Note 3: For removing a specific repository file.WinEdit("Agent Name:").Dialog("Flights Table").Set "gcr" Window("Flight Reservation").Click Note 1: For loading repository file (Reposotoirescollection. Repositoriescollection.Close Repositoriescollection.Click Pos=Repositoriescollection.exe" Dialog("Login").Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.WinEdit("Password:").Select "Denver" Window("Flight Reservation").COM 49 .WinComboBox("Fly To:").Click Window("Flight Reservation").Select "London" Window("Flight Reservation").WinButton("Insert Order").Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.remove (position) Note 4: For removing all loaded repositories Repositoriescollection.Activate Window("Flight Reservation").Set "mercury" Dialog("Login").

Types of Framework: 1. Linear framework or Record/Playback framework. environment variable files and storing them in the www. Creating the required Creating the required corresponding folder.COM 50 .com Automation Framework Framework: It is a generic work (outline work) or a set of guidelines designed by experts to perform a task(s) in an effective. Keyword driven framework: • • • • Creating the required Creating the required corresponding folder.For QTP Scripts & Other Information visit: www. shared repository files & storing them in the library files and storing them in the corresponding folder. Test Case file & storing it in the corresponding folder. efficient and optimized way.GCREDDY. 2. Modular framework Keyword driven framework Hybrid framework Linear framework: • • • • • • Generating the basic test using recording feature Enhancing the test using Tool features Debugging the test if required Running the test Analyzing results Sending defects Modular framework: • • • • • Generating the individual components for each and every task (Actions) Making them as reusable components Preparing the required driver scripts Executing the Drivers Analyzing the results. 4. 3. Automation framework: It is a systematic approach developed by experts for automating any application.gcreddy.

In driver script we call required functions . Recovery Scenarios During the execution QTP may face some problematic situations where in it needs to recover by itself and continue the Note: In this framework we create required tests and make them as functions. 1. 1.gcreddy. 3. Editing a Recovery Scenario: www.For QTP Scripts & Other Information visit: www. Initialization Script It launches QTP Tool and calls Driver Script 2. Driver script It executes all tests one by one. 2. In this framework we have 2 scripts only. 4. then we need to modify the Driver script only. QTP may face 4 types of problematic situations: 1.GCREDDY. 2. Popup window Object State Test runner error Application Crash Creating a Recovery Scenario: Navigation: Resources menu>Recovery Scenario manager>click new scenario icon>Click Next>Select Trigger event(Test run error) >Click next>Select error type (item in list or menu not found)>click next>click next>select recovery operation(Function Call)>click next>browse path of function library(notepad)>click next >check another recovery operation if required>click next>select post recovery operation(proceed to next step)>click next>enter scenario name>click next>Check add scenario to current test if required>click finish>click save>click close. 4.COM 51 . 3. If we want to execute our desired tests. Problems problems Problems problems related related related related to to to to path of the windows object state Test execution application crash To define a solution for the above problems QTP has provided 4 trigger events. To do the same the Test Engineer would have defined a solution well in advance and made it available to current test before starting the execution.

SetCurrentRow(i) Invokeapplication "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.3) ares=VbWindow("Form1").Click eres= Datatable.1.Activate Dialog("Login").3) Dialog("Login").VbEdit("val1").Close Next Example 2): datatable.AddSheet "gcr" datatable.ImportSheet "C:\Documents and Settings\Administrator\Desktop\gcreddy.GetRowCount For i= 1 to n Datatable.GetRowCount For i= 1 to n datatable. Addsheet method Data Table Methods Adds the specified sheet to the run-time Data Table and returns the sheet Syntax: Datatable.3) Dialog("Login").WinButton("OK").3) VbWindow("Form1").Set datatable("V2".COM 52 .Click Window("Flight Reservation").Value ("res".3)=pass else datatable("res".gcreddy.Set datatable("agent".WinEdit("Password:").3) VbWindow("Form1").VbEdit("res").GetSheet (3).AddSheet "gcr" datatable.Set datatable("V1".For QTP Scripts & Other Information visit: www.exe" Dialog("Login").1.3 n=datatable.3)=fail www.GetSheet (3).com Navigation: Resources menu>Recovery Scenario manager>click open>browse path of scenario file>Select scenario>click edit icon>click next(through navigating modify required values)>click finish>click save>click close.ImportSheet "C:\Documents and Settings\Administrator\Desktop\gcreddy.GetROProperty ("text") If eres=ares Then datatable("res".3 n=datatable.GCREDDY.xls".Set datatable("pwd".Addsheet “sheet name” DeleteSheet method Example1): datatable.SetCurrentRow(i) VbWindow("Form1").xls".VbEdit("val2").VbButton("ADD").Activate VbWindow("Form1").WinEdit("Agent Name:").

For QTP Scripts & Other Information visit: End If Next www.gcreddy.GCREDDY.COM 53 .

Sign up to vote on this title
UsefulNot useful