QTP 9.

2

Material Prepared by Sriraman K

Objectives
‡ Automation ² Need for automation, Rules of automation ‡ Exposure to the Automation Concepts and Kick start the learning of one of the leading tool QTP

2

Need of Automation
‡ Speed ² Automation Scripts run very fast when compared to human users ‡ Reliable ² Tests perform precisely the same operations each time they are run, there by eliminating human error. ‡ Repeatable ² We can test how the application reacts after repeated execution of the same operation ‡ Comprehensive ² We can build a suite of tests that covers every feature in our application ‡ Reusable ² We can reuse tests on different versions of an application, even if the user interface changes.

3

Rules of Automation
Testing Tools are usually very expensive. The test manager or the test lead has to think twice before going in for automating his test effort. There are also some widely held false notions or beliefs about automation tools. In general, the golden rules that should be kept in mind in the regard are.

4

‡ Do not build application logic in your test scripts ‡ Always have a common know base state for test cases ‡ One test script Action must address one test case. defect tracking. 5 . DO NOT AUTOMATE. ‡ Every manual step has commands in test scripts ‡ If it is not worth. test bed setup.Golden Rules ‡ Product feature understanding. test case documentation. test planning. progression tests are all done in manual mode ‡ Test automation success depends on robustness of the test cases not on the test tool.

Watir) 6 .What are the different tools available in the market (for functional testing)‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ Quick Test Professional (HP) WinRunner (HP) Robot (IBM Rational) Functional Tester (IBM Rational) SilkTest (Borland) TestComplete (AutomatedQA) QAWizard (Seapine) TestPartner (Compuware) QEngine (AdventNet) Open source tools (Sahi.

Life Cycle Of AutomationAnalyze the Application Select The Tool Identify the session Design/ Record Test Scripts Run the test scripts Finding & Reporting the defects 7 .

Linux etc 8 . Delphi ‡ ERP -> SAP. J2EE.5 Test Script developed on VB Script QTP supported Technology ‡ . Main Frame. present version in the market is 9. Java.NET. XML. Seibel. People soft ‡ QTP Supports both Technical & Non Technical People ‡ QTP run on only windows platform not supporting UNIX.Introduction to QTP ‡ ‡ ‡ ‡ ‡ ‡ Developed by Mercury interactive now owned by HP Developed for web functionality QTP supports both web applications & windows applications QTP Developed in 2002.

9.0. 6. 6.11. 7.2 System Requirement Hardware Drive RAM OS : Equivalent to P3 and above : 250MB of Free Memory space : 512MB of RAM : M/S windows 2000 server with 3-4 service pack M/S windows XP with 1-2 SP M/S windows 2003 with no service pack : MS Internet Explorer 5.Environment needs for QTP 9. 7.02.22.0 Web Browser 9 .1 AOL 8.23.5 and above Netscape Navigator 6.

NET ‡ Terminal Emulator (RTE) ‡ SAP ‡ Siebel ‡ Delphi 10 .Add Ins of QTP Technology supported by the QTP By default three Add Ins are there in QTP ‡ ActiveX ‡ VB ‡ Web Additional Add ins: ‡ Java ‡ Oracle ‡ People soft ‡ .

Window Structure of QTP 1) Test Pane 2) Active Screen 3) Data Table 4) Debug Viewer 11 .

mts file) Action1 Rep1(.tsr File) Global Sheet Environment Parameter Test Parameter Action3 Rep3 Sheet3(localSheet) Parameters (Action Parameter) ´ ´ Action2 Rep2 Sheet2(localSheet) Parameters (Action Parameter) 12 .Architecture Of QTP Script(.mtr file) Sheet1(localSheet) Parameters (Action Parameter) Shared Repository (.

Split command. Low Level Record Managing Script with Various Data ± Parameters (DataTable) ‡ VB Scripting (String Manipulation.Course Objective ‡ Object Spy ‡ Object Identification ± Understanding customizing Non ² Standard Objects ± Understanding Way of Recognition ‡ ‡ ‡ ‡ Object Repository Simple Record and Replay Types of Record ± Context Sensitive. InStr. Loops. Msgbox. Bitmap. Text 13 . Analog. Conditions) ‡ Managing Script with Dynamic Objects ± Regular Expression ± Smart Identification ‡ Check Points ² Standard.

14 .Object SpyObject spy is used to display or view all the physical properties and methods of an object.

coordinate of the screen or parent object Nearest to x is 0) Index (Works based on active screen ² active screen being 0 by default) Creation Time (For web browsers. no. ± Recognition properties are configured using ‡ ‡ ‡ Mandatory Properties Assistive properties (are used when mandatory property fails to recognize the object uniquely) Ordinal Identifier (are used when both mandatory and assistive fails to recognize the object uniquely) ± ± ± Location (Represent x.Object Identification‡ ‡ Used to Map non Standard Object to Standard Object Used to configure Recognition properties for an object class. of instances decides the creation time) 15 .

mtr File) and Shared Repository Mode (.tsr File) by the script 16 .Object Repository‡ Stores the object for the purpose of playing back ‡ Uses Logical Name and Description properties to recognize the object from script and application respectively ‡ Description Properties are created through Object Identification ‡ Repository can be managed using Per Action mode (.

Object Repository Dialog Box- 17 .

Analog Recording ² Understands only the key or mouse movements ± ± Relative to the screen: Desktop. ‡ Object(<<ObjName>>).RunAnalog ´Track1µ Relative to the window: Window(<<objName>>).45) 18 .Recording Modes ‡ Three Modes of Recording ± ± Context Sensitive or Normal Recording ² Uses the object class and properties and method to perform action.Click (22.RunAnalog ´Track1µ ± Low Level Recording ² Understand the x and y coordinate of the within the object on which the action is performed.

Record a Test 19 .

Record & Run Settings- 20 .

Run a Test and Save Results- 21 .

View Test Results- 22 .

Close 23 .Close If we are using Virtual object.Winobject(´colorsµ). Example: In normal recording if we select the paint brush window.16 Window(´Paintµ).Virtual Object‡ Virtual Object is used to identify the properties of similar objects in a particular Area.Activate Window(´Paintµ). the script will look like thiswindow(´Paintµ). the script will look like thiswindow(´Paintµ).Winobject(´colorsµ).Winobject(´colorsµ).Activate Window(´Paintµ).Click 80.Click 72.Virtual Button(´BLUEµ) window(´Paintµ).Winobject(´colorsµ).14 window(´Paintµ).Virtual Button(´REDµ) Window(´Paintµ).

Select Case ‡ Conditions ² If then Else 24 . Do while.VB Scripting ‡ Msgbox() ‡ Inputbox() ‡ String manupulation ‡ ‡ ‡ ‡ Using Variables Using Concatenation Split () Instr() ‡ Loops ² For loop.

Parameter(´ParaNameµ) Constant DataTable RandomNumber Environment Test Parameter ‡ Action Parameter ± ± ± ± ± ‡ ‡ Test Parameter ± Constant (Test Parameter can be configured only through Action Parameter) Environment Parameter ± Build In ± User Defined 25 .Parameters ² Data manipulation ‡ Script Level Parameterization ± ± ± ± ± Constant DataTable(´clmNameµ.dtLocal/GlobalSheet) RandomNumber(start.End) Environment(´Paranameµ) Action Parameter .

Right Click. ± To control the iteration of Action Sheet. Go to Action. Select Action Properties and give Default value to be used.Action Parameter ‡ Action Parameter ± To create an Action Parameter ² Go to Action. ± To Modify Action Parameter default value ² Go to Action. select value column and click on configure value button under value. Select Action Call Properties and select the parameter for which modification is needed. Right Click. Right Click. Select Action call properties and Run tab 26 .

Test Parameter &Environment ‡ Test Parameter ± File->Setting->Parameter Tab ± Only constant value can be used ± To use the test parameter in the script. ‡ Environment Parameter ± File->Setting->Environment Tab ± Build in and User defined parameters ± To use the environment in other machines. Test parameter needs to configured to action parameter. use export and import under environment parameter tab 27 .

Setting the Parameter Value- 28 .

Local & Location)- 29 .Using Data Sheet (Global.

Select ´at the end of testµ radio button) ± Creating as Nested Action (Call to new action. Right click. Select ´After the current testµ radio button) ‡ Dependent Action ² One action depends on another action for want of data ± Using Datatable Output Value ± Using Output Parameter Output Value ± Output value ‡ Select the object from active screen.Multiple Actions ‡ How to Create New Actions? ± Creating as Independent Action (Call to New action. Select output value ‡ At Recording time Select from menu Insert->Output Value>Standard Output value 30 .

Exist Command ‡ Syntex of Reusable Action ± RunAction ´ActionName[ScriptName]µ. One/Alliteration. Parameters(optional) 31 .Reusable Actions ‡ How to make an action as Reusable Action? ‡ Passing Parameters for Reusable Action ± Using Input Parameters ± Using Output Parameters ‡ SystemUtil Commands ‡ .

Value ± Regular Expression ± Repository Parameter ± Smart Identification ‡ What is Smart Identification? ± It is a second level of Recognition Mechanism to recognize an object when it is failed using Description properties ± It is not a permanent method to solve a dynamic object ² It is an indication to the user that the object is not managed using description properties 32 .Dynamic Objects‡ What is Dynamic Object? ‡ When we can say. the object is dynamic? ‡ Ways to Solve those dynamic objects ± SetTOProperty ‡ Parent().SetTOProperty ´propertyNameµ.Object(´Logicalµ).

Regular Expressions can be used in the following areas: 1) Check Points 2) In parameterization 3) Data Driven test 4) Actions 5) Exception Handling«.Regular Expressions‡ This can be used where there is a pattern of Change.etc 33 .

Using a Regular Expression- 34 .

Some Regular ExpressionsExpression Period Asterisk Char . * Description Matches any single character Matches zero to any number of occurrences of the preceding character Matches one to any number of occurrences of the preceding character Matches a range of characters Matches a range of numbers Matches any alphanumeric character including underscore Matches any non-alphanumeric character Matches any digit Matches exactly four digits Plus + Brackets [A-Z][a-z] [0-9] \w \W Digit \d \d{4} 35 .

system takes more time than usual time so if an object is identified in smart identification method then that object needs to be attended Two properties are available in Smart identification They areBase Filter Properties (This property has to match) Optional Filter Properties (Atleast one of the property should be unique) 36 . it tries to identify the object using Smart identification. When the Quick test fails to recognize the object through description properties. By invoking smart identification.Smart Identification‡ Smart Identification is used as Second level of recognition mechanism.

‡ Types of Synchronization ± ± ± ± Sync Wait WaitProperty Exist 37 .Synchronization Point‡ Synchronization point maintains the time coordination between testing process and your application process.

‡ ‡ ‡ ‡ ‡ ‡ Standard Check Point Text/ Text Area Check Point Bitmap Check point Database Check Point XML Check Point Accessibility Check Point/ Web Checkpoint 38 .Check Points‡ Check Point is a verification point that compares the current value of the specified property with the expected value for that property.

Checkpoint Types 39 .

Inserting a Checkpoint During Recording- 40 .

Insert a Checkpoint After Recording- 41 .

Identifying a Failed Checkpoint- 42 .

Exception Handling‡ It enables Quick test to detect and handle when unexpected error occurred during execution time. Types of Exception Handling: ± ± ± ± Popup Exception Handling Object State Exception Handling Test Run Exception Handling Application Crash ‡ 43 .

44 .Comments & QueriesQueriesQueries are always welcome.

Address is available at www. in case you feel this helps you.Your Voluntary Contribution ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ To enhance the service by improving bandwidth and improve the e-learning methodology needs an investment. it is absolutely voluntary and optional Company : Softsmith Infotech Pvt Ltd.Kodambakkam . Expecting your kind support. Bank Name : HDFC Bank Ltd Account Type: Current A/C Account No : 05742320000031 Branch : Chennai .com 45 . ³Little drops of water make the mighty ocean´. kindly contribute any amount to the below mentioned account.softsmith.Tamilnadu Cust ID : 25417385 Branch Code : 0574 When remitting kindly mention your name and course You can also send DD to the above mentioned name in case direct transfer is not possible.

. 46 .FeedbackFeedback- Please spend few minutes from your valuable time to provide your feedback. It will help us to improve in next sessions. Contact Details Sriraman K Email : sriramank@softsmith.com Thanks & Happy Testing.

Sign up to vote on this title
UsefulNot useful