You are on page 1of 138

Automation Fundamental Concepts and Intro. about QTP 10.


Automation Fundamental Concepts

What is Test Automation ?   

Software Test Automation is the process of automating the steps of manual test cases using an automation tool Or utility to shorten the testing life cycle with respect to time« When application undergoes regression, some of the steps might be missed out or skipped which can be avoided in Automation« Automation helps to avoid human errors and also expedite the testing process« To implement the Test Automation detailed planning and effort is required

Automation Fundamental Concepts
Automation saves time and effort which results in reduction of the Test life cycle« Benefits of Automation - Consistency of Test Execution - Reducing cycle time of regression test cycles - Data driven testing - Repeatability - Coverage - Reliability - Reusability of test wares

 Stability of AUT (Application under test)  No of regression cycles to be performed  Compatibility of App platform with testing tools  Cost benefit analysis (ROI)  Availability of skilled resources .Automation Fundamental Concepts Automation life cycle is a subset of the entire test life cycle« Automation planning can be initiated in parallel to the test planning phase« Factors to be considered in automation planning.

 If the application is planned to have multiple releases / builds  If it¶s a long running application where in small enhancements / Bug Fixes keeps happening  Test Repeatability is required .Regression Testing & Automation When Automation is applicable? ‡ Regression Testing Cycles are long and iterative.

ActiveX controls 4.2 AddQuickTest Professional Terminal Emulator Add-in 8. Standard Windows applications 2.2* AddQuickTest Professional Add-in 8.2 Add- .1 AddQuickTest Professional .2 for SAP Solutions AddQuickTest Professional Siebel Add-in 8.0* AddQuickTest Professional VisualAge Smalltalk Add-in 8. Visual Basic applications Supported Add-ins AddQuickTest Professional Java Add-in 9.0* AddQuickTest Professional Stingray Add-in 8.2 AddQuickTest Professional Web Services Add-in 9.2 AddQuickTest Professional PeopleSoft Add-in 8.2 AddQuickTest Professional Oracle Add-in 8. Web objects / Applications 3.NET Add-in 9.Technologies Supported Default Support 1.

0 Service Pack 1 Microsoft Internet Explorer 7.Supported Browsers Microsoft Internet Explorer 6.2 Mozilla Firefox 1.1.0 Netscape Browser 8.0 .5 Mozilla Firefox 2.

Net and many more .AddAdd-in Manager Default Add-ins Add ActiveX  Visual basic  Web Other Add-Ins Add Siebel  Java  SAP  Oracle  .

Add It is critical for the users to know the development technologies / environment of AUT. Add- . and load right Add-Ins while invoking Quick Test Pro.AddAdd-in Manager Cont« Cont«  QTP¶s Add-in Manager facilitates the users to select the technology / environment from Addvariety of environments suitable for the AUT (Application Under Test)  Once an add-in is loaded. users can record that application in its supported environment addand thus QTP recognizes the objects specific to the application under test (AUT) as loaded through Add-in Manager.

Siebel. and Visual Basic applications. ActiveX controls. Web objects. Oracle. You can also acquire additional QuickTest add-ins addfor a number of special environments (such as Java.NET Windows and Web Forms. and terminal emulator applications). the Mercury advanced keyword-driven testing solution keywordenables you to test standard Windows applications. Web services. .Mercury QuickTest Professional Introduction to QTP  QuickTest Professional. PeopleSoft. SAP Solutions. .

enabling you to view the details of toolbar² an individual action or the entire test flow. For a component. pane² Active Screen²Provides a snapshot of your application as it appeared when you Screen² performed a certain step during the recording session. toolbar² Testing toolbar²Contains buttons to assist you in the testing process. Test pane²Contains the Keyword View and Expert View tabs. toolbar² Debug toolbar²Contains buttons to assist you in debugging your test or component (not toolbar² displayed by default).QuickTest Window The QuickTest window contains the following key elements:            QuickTest title bar²Displays the name of the currently open test or component. For a test. the Data Table contains single tab. bar² File toolbar²Contains buttons to assist you in managing your test or component. bar² . Action toolbar²Contains buttons and a list of actions. the Data Table Table² contains the Global tab and a tab for each action. Variables. and Command tabs (not displayed by Expressions. The Debug Viewer pane² pane contains the Watch Expressions. Debug Viewer pane²Assists you in debugging your test or component. Data Table²Assists you in parameterizing your test or component. default). Variables. Status bar²Displays the status of the QuickTest application. bar² Menu bar²Displays menus of QuickTest commands.

QTP .Main Window .

icon based tree« Expert View:  Quick Test Pro displays the source code (VB Script) of the tests in this view.Keyword View .QTP . .Expert View Keyword View: Quick Test Pro displays your test in the form of a collapsible. .Main Window Test Pane:  Test Pane contains two labs to view the tests.

QTP Window .

Prepare to Record Objectives Review documented user steps of a business transaction. Understand the application under test and its environment. Prepare the test environment to utilize QuickTest Professional correctly.1. .

Record & Run Modes Recording Modes  Normal  Analog  Low level Run Modes  Normal  Fast  Update .Quick Test Professional .

Quick Test Professional -Tools Options General  Click on ³Restore Layout´ button to reset screens to the initial setting when QuickTest was first installed. .

QuickTest Professional Options->General Options- A best practice when setting general options for QuickTest are to: ‡Deselect all check boxes except ³Save data for integrating with performance testing «´ and ³Display Add-in Manager on startup´. ‡Click on ³Restore Layout´ button to reset screens to the initial setting when QuickTest was first installed. .

Tools Options Run .Quick Test Professional .

Quick Test Professional . Synchronization becomes better for the AUT (Application Under Test)  Test Results: Deselect the option ³View Results when run session ends´  Mercury Tool Integration: Select "Allow other Mercury products to run tests and components³  Screen Capture: Save step screen capture to results "On error and warnings" .Options Run Best Practices for Options for Run Mode:  Run Mode as Normal: This ensures that the execution arrow appears to help with trouble shooting the tests.

Automation Record and Run Settings .

Manually recall this window by selecting Automation Record and Run settings  .This window will appear the first time you click on the Record button in the new test.Record and Run Settings Best Practices for Record & Run Settings  Set the options to configure QTP to "Record and run test on any open WindowsWindowsbased application³  Set the option .

Run a test and check for errors. Discuss the importance of initial and end conditions.2. Store the test file. Create a Test Objectives Create a basic test from a manual test case. .

You can choose to focus on one or more areas depending on the task you are performing. .The User Interface The QuickTest Professional user interface is broken up into a number of functional areas.

This results in the recording and storing of each step of the business process. Each step consists of:  The object  The method (operation)  The method property (a value for the action performed on the object) QuickTest should be running before the application under test is invoked. QuickTest listens and records the activities.Record a Test Once the record button is pressed and test steps are performed . this is mandatory. . For some environments.

Select your folder 2. Save the file Save a test in QuickTest Professional If you are using QuickTest Professional alone the file system you will save to is under the QuickTest Professional¶s test directory. Type in the test name 3.Saving a Test Saving the test in Quality Center Only relevant when using QTP with QC A bulls-eye symbol in the header with ³Open Test from Quality Center´ appears bullsA folder structure is listed under the parent directory ³Subject´ You have the option to click the File System button on the upper right corner Once you have logged into Quality Center: 1. You have the option to save the test results along with the test. .

click on the Run Button. A best practice is to use the temporary folder to hold the results while debugging your test.Steps to Run a Test    From the QTP Toolbar. . Press the OK button to execute the Run command.

. When QuickTest finishes running the test. QuickTest performs each step as it was recorded.Viewing the Test Run When you run a test. A yellow arrow in the left margin of the KEYWORD VIEW points out the step currently running. You can watch in the AUT as QuickTest performs each step. you can open the Test Results window.

Decide if results must be viewed. select VIEW->EXPAND ALL . View the outcome of the test run. 4. select TEST->RESULTS from the QTP menu bar. 3. Expand the results tree. If yes. 5. From the Test Results menu bar. 2.Steps to View the Results 1.

Navigate to the child step that caused the failure. .View Test Results Failure ³roll-up´ to the parent at the top level of the tree. Expand the Test Results tree to see the outcome of each step.

The Object Repository Objectives Define what a Quick Test Professional object is. .3. Describe how objects are recognized by Quick Test Professional. Describe the role of the Object repository Identify a given object as part of a class. Use the Object Repository to find and add objects. Change object logical names using the Keyword View.

Graphic Images and Edit Boxes are a few examples of class types. dropObjects are categorized into classes.Object Types A Quick Test Professional object is a graphic user element in an application. Buttons. such as a button or a drop-down list. .

QuickTest Object Properties In the example above. The only way to distinguish one object from the other of the same class is by the difference in object characteristics. two of which are: Update Order Delete Order. Specific characteristics of an object within QuickTest are called object properties. . there are several objects called Buttons.

QuickTest might classify the test object as a standard Windows dialog box or a web button. For each object class. Usually.QuickTest Recognizes Objects QuickTest uses a method when it learns objects during the recording process. determining its object class. QTP has a default set of properties that it always learns. only a few properties are needed to uniquely identify an object. For example. QuickTest first looks at the object you are recording and stores it as a test object. .

QTP assigns a name to the object. This is known as the object¶s logical name. QTP refers to the object in a recorded test by using its logical name. but changing a logical name can give clarity to the test and the documentation that is generated. . Edit the logical name to make it more descriptive if you wish.Assigning a Logical Name After learning the class and properties of an object. The logical name given to an object during recording may be sufficient.

These ³stored´ objects are referred to as ³ Test Objects´. During a test run. Each test has its own Object Repository.. The purpose of a Test Object is to represent application objects in the test. . by default.Stored Test Objects Recorded object properties are stored in QTP¶s Object Repository. QTP uses the Test Object to search for a match in the application during run time.

Right-click on the object at the KEYWORD VIEW level. . Choose OBJECT PROPERTIES. Right2. 1. 3. Click on the REPOSITORY button.Steps to change A Logical Name You can change an object¶s logical name in the OBJECT REPOSITORY.

The Object Properties Dialog

Once in the Object repository: 1. 2. 3. 4. RightRight-click the object in the repository tree. Choose RENAME. Type a descriptive name for the object. Click OK.



cume tati

Quic est updates the bject ame a d d cume ts it i the d cume tati field f the Keyw rd View. IMPOR AN : if y u start a bra d ew test, the test will rec rd the rigi al, default bject ames i the Object Rep sit ry.

4. Synchronization
Objectives Define Synchronization. How to synchronize the Test Some Visual Cue Examples Examine when and where synchronization is most helpful. Add a synchronization step for a specified object.

The user/test waits for a visual indication that a step has completed so that the user/test can take the next step. .What is Synchronization ? Synchronization is a step added to a test that instructs QuickTest to wait for the state of a property on a particular object to change before proceeding to the next step in the test. This is done while in RECORD mode.

Inserting a synchronization point Insert Step Synchronization point Window(³Flights´).1000 2.Exist Wait(10) .How to synchronize the Test We can synchronize the test by 1.1.Dialog(³Flights Table´).WinButton(³Update order´).WaitProperty´enabled´.Adding Exist and Wait statements status=Window(³Flights´).

pop- . A status message appears. A progress bar reaches 100% completion. A button becomes enabled.Some Visual Cue Examples Synchronization point enables the anticipated time problems between the application and QTP. A pop-up message appears in response to an operation. A window opens and is ready for data entry.

Examine the Application Quick Test defaults to allocating the same amount of time for every object. If insufficient time is allocated for these special circumstances. in the Flights application. Wait times often occur before an object becomes available for the next step. a process bar must complete to yield the Order No. associated with the reservation. For example. . The error message ³Object not enabled´ appears if QuickTest is running a test and proceeds to the next step before the previous step has fully processed. The process bar may require additional time before the test can proceed. the test may fail. once the Insert Order button has been clicked.

From the QTP menu bar.Add a Synchronization Step While Recording Synchronization points which instruct QuickTest to pause until an object property achieves a specific value. choose INSERT STEP SYNCHRONIZATION POINT . Always add the synchronization point immediately after the step to be synchronized. as well. The easiest method is to add a synchronization point while recording. A Synchronization step can be added manually after a test is recorded .

Object Repository Object Repository is a place where QTP stores learned objects QTP uses default Object Identification properties: mandatory and assistive to learn objects into OR .5.

Object Repository Logical Name Properties .

OR: Object identification default properties .

. More properties for recognizing the object can be added to the list.Resources Object Repository Can add a New Object to the repository The value of property can be edited here.

Resources Object Repository Manager .

Resources Associate Repositories Add shared Repository .

Resources Object Repository Associate repository is added to the Filter option. .

Object Repository Merging tool Primary Repository. Secondary Repository .

Object Repository Comparison Tool Comparing two repositories' .

From Keyword view 3.From the Active Screen . Checkpoints A checkpoint is a verification point that compares a current value for a specified property with the expected value for that property. We can Insert checkpoint 1.6.From Menu Insert Checkpoint Standard Checkpoint 2.

Text Checkpoint 6.Bitmap Checkpoint 8.Table Checkpoint 4.Database Checkpoint .Standard Checkpoint 2.Page Checkpoint 5.Image Checkpoint 3.Text Area Checkpoint 7.Checkpoint Types 1.

RightRight-click on the appropriate field and choose ³Insert Standard Checkpoint´.Insert A Checkpoint From The Active Screen A checkpoint can be added after a test is created. . Use the Active Screen to select the field on which the checkpoint will be added.

.Regular Expressions Regular expressions enable Quick Test to Identify Objects and text strings with varying values.

you will answer No. Note: There are 4 steps to ensure that a regular expression is inserted correctly. ensure Constant is enabled and click on the note paper icon. Check Regular Expression checkbox. From the Checkpoint Properties window. For example. 6[A. Add the regular expression. it will ask you to treat it as a literal character.a- . If QTP sees there are characters that can be misconstrued as a regular expression.Use a Regular Expression A regular expression is a string that specifies a complex search phrase. Figure 6-6 will use [A-Z a-z]+. Generally. By using special characters you define the conditions of the search.

7. Parameters Objectives Describe and use multiple parameter types. Parameterize a checkpoint. . Analyze errors during iterations. Drive data in multiple iterations.

Input Parameters For Data driven Tests Input Parameters For Data Driven Tests A data-driven test is one that runs a set of user actions with multiple input values. repeatability. . free resources to do other kinds of quality control. Speed. thus increasing test coverage. dataData driving allows one script to test application functionality with many sets of data. Automated data driven testing frees you to perform more tests.

Input Parameter Input Parameters allow you to replace a static. which represents an expandable range of values. Input parameter values are input into the application from some outside data source. Input parameter names and their values are located in QuickTest¶s Data Table. recorded value in a step with a dynamic placeholder (parameter). .

click on the current value.Steps to Create An Input Parameter To create an input data table parameter: Select the step in the Keyword View that contains the recorded input value. The Constant value appears in the Value Configuration Options dialog box. From the Value column. Click on the parameterize button. .

Use the default Global data sheet to store values. select the Parameter radio button and ensure that Data Table is selected from the drop-down list. dropFrom the Name drop down list. Enter the values that QTP will input after the test executes. enter a unique column name to create a new column in your data table or choose an existing column name from the data table.Set the Parameter Value In the VALUE CONFIGURATION OPTIONS dialog. .

Supply Data to the Parameter The design-time table is the central designlocation for storing input parameter values. As a default. the design-time data table designis displayed at the bottom of the QuickTest screen. If you want to show or hide the data sheet. . click on the icon in the toolbar. The number of rows in the data table will cause the same number of test execution iterations to be run.

. Expand the tree for each iteration (Row#) to view specific information about the execution of the specific row.Verify The Test Run View the Test Results window to verify that each of the rows from the Design Time Data Table was used during the test run.

A checkpoint on a parameterized field.Parameterize a Checkpoint You can use parameterized expected values to make your checkpoints dynamic. . They Can be set on: An object property in the Object Repository.

By dividing your tests into multiple actions. . like the main sections of a transaction. you can design more modular and efficient tests. or by specific business processes. When you create a new test.A Test with Multiple Actions Actions can be divided into logical sections. it contains one action.

Types of Actions There are two kinds of actions: Regular (Non-reusable) (NonReusable Tests that contain reusable actions can be used: Locally Externally .

Insert Call to a New Action You can add a new action during or after recording. . Select Insert ? New Action from the QuickTest main menu. Or use the ³lego´ icon on the toolbar to insert new action. The Insert New Action window appears.

This creates a data flow between business processes. Be aware of any data dependencies that occur within the business process.Using Parameterized Data Test data can be passed from one test to another test using the value of an input parameter. . The value passed from one business process to another will come from the Data Table.

Existing or New Action After reusable actions are created. they can be called into a ³Main Calling´ test in three ways: Call to New Action Call to Copy of Action Call to Existing Action .Copied.

. A message will appear stating a description of a reusable action. Check the checkbox and click OK.Set Actions as Reusable Create a reusable action from the Action properties dialog.

View the components of the action tree (you cannot modify them except in the original script) Insert a call to an external action (the action is inserted in read-only format) readas local editable copy use the (read only) data from the original action Insert copies of non-reusable actions noninto your test. non- . but you cannot insert calls to non-reusable actions.Call An Action You can do number of things with a reusable action. Call it from other tests. such as: Call it multiple times within a test.

and enhancing this part of the script (with checkpoints and parameterization) separately for each test. . in the original action. Best Practice Inserting calls to existing actions makes it easier to maintain our tests. you can create an action that logs into the application in one test. It only needs to be updated one time. when an object or procedure in your application changes.One Action used Many Times Rather than recording the login process three times in three separate tests.

A message will appear stating a description of a reusable action. Check the checkbox and click OK. .Set Actions as Reusable Create a reusable action from the Action properties dialog.

. This makes the test easier for others to understand when viewing the test from the Keyword View tree. RightRight-Click on Action and enter a logical name for the business process.On Action ± Two Names Use the Action Properties ± General tab to modify the default label.

The external action is inserted into the calling test in a read-only format. you will see the parameters contained in each test appear in the Global or Local sheet depending on where you stored them in the original test.External Action Properties An external action is a reusable action created in another test. If read-only. readAfter a reusable action is called. readData from the external action¶s data sheet can be imported as a local. . the data can only be modified from the original test. editable copy or kept as read only.

Action Run Settings Since there are two (or more) tests running. one right after another. you may need to specify the iteration for each separately. To affect the run settings for a particular action. set them in the Action Call Properties dialog box. . and choose Action Call Properties from the list provided. RightRight-Click on the Action label in the Keyword View.

Defining an Action The Action Properties dialog box enables you to define options for the stored action. . You can modify an action name. and set an action as reusable. add or modify an action description.

Passing Values to a Called Action You can also define input and output parameters to be used by the action. . These settings apply each time the action is called.

Using an Action Parameter Once parameters have been set in Action Properties. . you can tell QuickTest that the parameter type being used is an Action Parameter.

Enables viewing of the action tree for a selected reusable or external action.Changes with the addition of a reusable action. The test flow appears when a test is recognized as having called actions in your test.The Test Flow List The Test Flow List: . An action tree displays all the details of the selected reusable or external action. . .

each Action will have its own: Folder with an object repository Local data table sheet Run settings .Action Data Structure In the Action data structure.

Run settings have to be set per action As a default. all actions in a test use the same shared Object Repository. reusable actions. Parameters and data from the called test are reflected in the calling test An action can be deleted or an action call can be deleted. keep the following in mind: Actions can be called or copied from another test. Position your action calls separately or nest them with other actions.Multiple Reusable Actions When using multiple. .

Delete an Action Because reusable actions can be used throughout your test or test set. you must decide to delete a specific occurrence of the action and/or all of its calls. when you delete an action. A different message appear when you are about to delete a non-reusable action. non- .

run‡ Provides a source of values that can be seen and used by any action. Data Table Sheets .Global The Global Data Sheet: ‡ Enables you to create a new column or select an existing column in the Global sheet of the Data Table. . ‡ Inserts or outputs a value from or to current row of the global data sheet during each global iteration at run-time.8.

It allows you to iterate reusable actions independently of any other called actions.Local When a Local Data Sheet is used: The parameters and data will appear with different tabs in the main calling test¶s Data Table.Data Table Sheets . You will need to link parameters in the ³main calling test´ .

A Recovery scenario consists of a) Trigger Event b) Recovery Operation c) Post Recovery Run Option .9. Recovery Scenarios To instruct Quick test to recover from unexpected events and errors that occur in the testing environment during the run session.

.Recovery Scenario Wizard We can create the recovery scenario using recovery scenario wizard. Recovery scenario wizard consists of a) Define the trigger event that interrupts the run session b) Specifying the recovery operations required to continue c) Choosing a post recovery test run operation d) Specifying a name and description for the recovery scenario e) Specifying whether to associate the recovery scenario to the current test and / or to all new tests.

Recovery Scenario Wizard .

Set myobject=Description.value:=³a´ Dialog(³name:=Login´).Set´impetus´ b) We can add a collection of properties and values to a description object and then enter the description object in the statement.WinEdit (myobject). Types of Programmatic descriptions a) We can list the set of properties and values that describe the object directly in a test statement.Creating Tests without Object Repository We can use programmatic descriptions to perform an operation on an object that is not stored in the Object Repository. e.WinEdit(³attachedtext:=agentname´).Set´impetus´ .value:=³agentname´ myobject(³html tag´).g: Dialog(³name:=Login´).Create() myobject(³attachedtext´).

QTP: Object Repository. Descriptive Programming and Beyond .

10. Enhance TestCases With Descriptive Programming Interact with Test Objects not stored in the Object Repository  You can also instruct QT to perform methods on objects without referring to the object repository without referring to the object¶s logical name. provide QT with a list of properties and values that QT can use to identify the object or objects on which you want to perform a method . To do this you name.

Syntax:Syntax:TestObject(³PropertyName1:=PropertyValue´.Move 50.50 .txtMyWin.txtIf you want to use the same programmatic description several times in one test. ³PropertyNameX:=PropertyValueX´) Where ³Test Object´ is test object class PropertyName is PropertyValue i. For Example: Window(³Text:=Myfile.Set MyWin := Window(³Text:=Myfile. the test object property and its value .50 Window(³Text:=Myfile.Move 50.txt-Notepad´). ³«´.e. you may want to assign the object you create to a variable. Each property:= value pair should be separated by commas and quotation marks.txt-Notepad´) Ex:Window(³Text:=Myfile. For Ex:.Enter Programmatic Descriptions Directly into Test Statements You can describe an object directly in a test statement by specifying property : = value pairs describing the object instead of specifying an object¶s logical name.

³width:=50´).Contd«.Create() MyDescription(³text´).(Instead of Entering) Ex:Window(³Error´).WInbutton(³text:=OK´. you Can specify the Properties object in place of a logical name in a test IF Entered« Set MyDescription= Description.WinButton(MyDescription).Click . Once we have filled the Properties collection with a set of Property objects (properties and values). For Ex:.Value=³OK´ MyDescription(³width´).Value=50 Window(³Error´).

VB Script basics ± Data Types .

VB Script basics ± Variables & Constants Declaring Variables Naming Restrictions Scope and Lifetime of Variables Assigning Values to Variables Scalar Variables and Array Variables Creating Constants .

VB Script basics .Operators .

Then. For..Next: Uses a counter to run statements a specified number of times.Wend: Loops while a condition is true...Loop: Loops while or until a condition is true...VB Script basics ± Conditions & Looping Conditional Statements  If...Else statement  Select Case statement Looping  Do..   . For each.  While....Next: Repeats a group of statements for each item in a collection or each element of an array..

VB Script basics ± Functions .

External. Synchronization points Exception Handling .Key areas in QTP About the script structure Actions (Simple. Re-usable) ReParameterization (Different Types) Checkpoints (Programmatic Methodology) Descriptive programming Adv. Nested.

About the script structure .

Re-usable) ReStandalone Actions Nested Actions Integration of Actions (Call from One Action to other) Driver Action (Main Action) ReRe-usable Actions External Call for Actions .Actions (Simple. External. Nested.

Parameterization Classifications of Parameterization  Test and Action Parameters  Data Table (Global & Action Specific)  Environment variables  Random Number .

Check how long a Web page takes to load or if a Web page contains broken links.Types of Checkpoints Standard Checkpoint Image Checkpoint Table Checkpoint Page checkpoint Checks values of an object¶s properties Checks the property values of an image Checks information in a table Checks the characteristics of a Web page Check that a radio button is selected. Text / Text Area Checkpoint Checks that a text string is displayed in the appropriate place in a Web page or application window Checks an area of a Web page or application after capturing it as a bitmap Bitmap Checkpoint . Check whether the expected text string is displayed in the expected location on a Web page or dialog box Check that a Web page (or any portion of it) is displayed as expected. Check that the value in a table cell is correct. Check that the image source file is correct.

Cont«. Note: XML file checkpoints are used to check a specified XML file. XML application checkpoints are used to check an XML document within a Web page. Check if the images on a Web page include ALT properties. required by the W3C Web Content Accessibility Guidelines. Accessibility Checkpoint XML Checkpoint . Database Checkpoint Checks the contents of databases accessed by an application or Web site Identifies areas of a Web site to check for Section 508 compliancy Checks the data content of XML documents Check that the value in a database query is correct.

Value = 50 Window("Error").Page("Title:=Mercury Tours").WinButton(MyDescription).Descriptive Programming Samples Descriptive programming  Entering Programmatic Descriptions Directly into Statements Browser("Mercury Tours").Click  .Set "Mark Twain" Using Description Objects for Programmatic Descriptions Set MyDescription = Description.Value = "OK" MyDescription("width").WebEdit("Name:=Author". "Index:=3").Create() MyDescription("text").

Synchronization Points     Using tool menu options Wait property Programmatically Wait & exist .Adv.

Exception Handling Recovery Scenario Concepts Recovery Process  Trigger Events  Recovery Operation  PostPost-recovery Operation .

WinComboBox(" ly rom:").WinComboBox(" ly rom:").Getting the entire content of the combobox Var_Content = Window(" light Reservation").Sample Script QTP uncti ns 'sample 1 .GetItemsCount msgbox My_Cnt or i = 1 to My_Cnt ' the combobox item index will start from zero. My_item = Window(" light Reservation").GetItem(i-1) Msgbox My_item Next 'sample 2 .GetContent Msgbox Var_Content .Getting all the items fr m the combobox from My_Cnt = Window(" light Reservation").WinComboBox(" ly rom:").GetItem(irom:").

Select(5) 'sample 4 .Using Variable Var_Item = "Zurich" Window("Flight Reservation").WinComboBox("Fly From:").Selecting an item from the combo .Sample Script ± QTP Functions 'sample 3 .WinComboBox("Fly From:").WinComboBox("Fly From:").Using Index Window("Flight Reservation").Selecting an item from the combo .WinComboBox("Fly From:").GetSelection Msgbox Var_Sel .Using Value Window("Flight Reservation").Getting the value of selected item Var_Sel = Window("Flight Reservation").Select(Var_Item) 'sample 6 .Selecting an item from the combo .Select("London") 'sample 5 .

GetROProperty("AttachedText") Msgbox Var_Text Var_Enab = Window("Flight Reservation").WinEdit("Name:").GetROProperty("Enabled") Msgbox Var_Enab 'Exist If Window("Flight Reservation").Sample Script ± QTP Functions ' Some FUM's (Frequently Used Methods) 'GetROProperty Var_Text = Window("Flight Reservation").WinEdit("Name:").Exist(5) Then Msgbox "The Editbox exists" Else Msgbox "The Editbox does not exist" End if .WinEdit("Name:").

Descriptive Programming ±what to use? There really is no ³best way´ Use the method that gives your company the best ROI.Object Repository vs. whether that be Object Repository (OR). Descriptive Programming (DP) or a mixture of both .

OR Pros and Cons PROS: GUI Front end to examine all the objects in the repository Highlight in Application feature is great tool to walk the object tree No need to modify the script when object properties changes Easy to identify objects in AUT by Object Logical names Can be created independently from scripts CONS: Additional layer to maintain Unnecessary objects can be created Multiple users cannot concurrently save/write to the shared OR It won¶t eliminate the need for Descriptive Programming in most of cases .

DP Pros and Cons PROS: It¶s a white box Compatible with different QTP versions Code portability is high Easy to mass update CONS: Lower Code Readability and requires more comments. like ³what object is accessed´ Potentially slower to create To highlight an object in the application requires utilizing the ³Highlight´ method .

What is Object Repository? Object Repository is a place where QTP stores learned objects QTP uses default Object Identification properties: mandatory and assistive to learn objects into OR .

Object Repository Logical Name Properties .

OR: Object identification default properties .

Script playback using OR
QTP finds the Object in Object Repository using object Logical Name and Object Hierarchy QTP retrieves Test Object properties from OR QTP searches actual application for the Object with the same properties as the OR Test Object and performs user action

Script playback using Descriptive programming
QTP searches the Application Under Test (AUT) for the Object using Descriptive properties and performs user action

Descriptive programming ± when and why?
Consider using DP in following cases: Dynamic object properties Example: Link Logout <User Name> Same objects on every page Example: Buttons ± Next, Back, Cancel, OK Lots of similar objects on one page Example: table with many First & Last name text boxes

Different ways to work with objects

Different ways to work with objects Example for Passenger 1 First Name .

ChildObjects method ± using Collection Object .

ChildObjects method ± using Collection Object Last Name fields are populated .

<property/method> refers to the AUT Object NATIVE properties/methods .Object.<property/method> . RO and .GetTOproperty/SetToProperty refers to the properties stored in OR .Object .GetROProperty property refers to the AUT Object property (Run-time) (Run.TO.Object.

Better names for Object Spy radio-buttons radioRun-Time NATIVE Object Run-Time QTP (Test) Object .

Object Run-Time Properties from AUT Run(GetRoProperty) .

RunRun-Time ³Native´ Object Properties/Methods from AUT (.Object) .

Test Object Properties from OR Set/GetToProperty .

Regular Expressions in OR Example: Server independent Page object 1. Click RegEx Icon . Click on Property value to access RegEx 2.

Regular Expressions in OR .

Regular Expressions in OR RegEx icon .

Object Smart Identification Smart Identification is not Artificial Intelligence SI uses loose/unreliable object recognition It¶s recommended to disable SI for each and every page/window/control using the ToolsTools>Object Identification dialog (Recording) Another way to disable SI: File -> Settings -> Run -> Check the "Disable Smart Identification during run session" check box (Run-Time) (Run- .

Smart Identification (SI) Recording Options SI Checkbox .

Smart Identification (SI) Run Option SI Checkbox . .Thank You Kuldeep Sharma (185459) Mobile : +919910664553 | HCL Technologies Ltd.