qtp with descriptive programming
Embed Size (px)
- Automation Fundamental ConceptsandIntro. about QTP 9.2
2. 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
3. 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
4. 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,
- 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
5. Regression Testing & Automation
- When Automation is applicable?
- Regression Testing Cycles are long and iterative.
- If the application is planned to have multiple releases / builds
- If its a long running application where in small enhancements/ Bug Fixes keeps happening
- Test Repeatability is required
6. Technologies Supported
- Default Support 1. Standard Windows applications 2. Web objects / Applications 3. ActiveX controls 4. Visual Basic applications
- Supported Add-ins QuickTest Professional Java Add-in9.1QuickTest Professional .NET Add-in9.2QuickTest Professional Oracle Add-in8.2QuickTest Professional PeopleSoft Add-in8.2* QuickTest Professional Add-in8.2 for SAP Solutions QuickTest Professional Siebel Add-in8.0* QuickTest Professional Stingray Add-in8.2 QuickTest Professional Terminal Emulator Add-in8.0* QuickTest Professional VisualAge Smalltalk Add-in8.2 QuickTest Professional Web Services Add-in9.2
7. Supported Browsers
- Microsoft Internet Explorer6.0 Service Pack1
- Microsoft Internet Explorer7.0
- Netscape Browser8.1.2
- Mozilla Firefox1.5
- Mozilla Firefox2.0
8. Add-in Manager
- Default Add-ins
- Visual basic
- Other Add-Ins
- .Net and many more
9. Add-in Manager Cont
- QTPs Add-in Manager facilitates the users to select the technology / environment from variety of environments suitable for the AUT (Application Under Test)
- Once an add-in is loaded, users can record that application in its supported environment and thus QTP recognizes the objects specific to the application under test (AUT) as loaded through Add-in Manager.
- It is critical for the users to know the development technologies / environment of AUT, and load right Add-Ins while invoking Quick Test Pro.
10. Mercury QuickTest Professional
- Introduction to QTP
- QuickTest Professional, the Mercury advanced keyword-driven testing solution enables you to test standard Windows applications, Web objects, ActiveX controls, and Visual Basic applications. You can also acquire additional QuickTest add-ins for a number of special environments (such as Java, Oracle, SAP Solutions, .NET Windows and Web Forms, Siebel, PeopleSoft, Web services, and terminal emulator applications).
11. QuickTest Window
- The QuickTest window contains the following key elements:
- QuickTest title bar Displays the name of the currently open test or component.
- Menu bar Displays menus of QuickTest commands.
- File toolbar Contains buttons to assist you in managing your test or component.
- Testing toolbar Contains buttons to assist you in the testing process.
- Debug toolbar Contains buttons to assist you in debugging your test or component (not displayed by default).
- Action toolbar Contains buttons and a list of actions, enabling you to view the details of an individual action or the entire test flow.
- Test pane Contains the Keyword View and Expert View tabs.
- Active Screen Provides a snapshot of your application as it appeared when you performed a certain step during the recording session.
- Data Table Assists you in parameterizing your test or component. For a test, the Data Table contains theGlobaltab and a tab for each action. For a component, the Data Table contains single tab.
- Debug Viewer pane Assists you in debugging your test or component. The Debug Viewer pane contains theWatch Expressions ,Variables , andCommandtabs (not displayed by default).
- Status bar Displays the status of the QuickTest application.
12. QTP - Main Window 13. QTP - Main Window
- Test Pane:
- Test Pane contains two labs to view the tests,
- - Keyword View
- - Expert View
- Keyword View:
- Quick Test Pro displays your test in the form of a collapsible, icon based tree
- Expert View:
- Quick Test Pro displays the source code (VB Script) of the tests in this view.
14. QTP Window 15. 1. Prepare to Record
- 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.
16. Quick Test Professional - Record & Run Modes
- Recording Modes
- Low level
- Run Modes
17. Quick Test Professional -ToolsOptionsGeneral
- Click on Restore Layout button to reset screens to the initial setting when QuickTest was first installed.
18. QuickTest Professional Options->General
- 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.
19. Quick Test Professional- ToolsOptionsRun 20. Quick Test Professional- OptionsRun
- 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.
- 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"
21. AutomationRecord and Run Settings 22. Record and Run Settings
- Best Practices for Record & Run Settings
- Set the options to configure QTP to "Record and run test on any open Windows- based application
- Set the option - This window will appear the first time you click on the Record button in the new test.
- Manually recall this window by selecting Automation Record and Run settings
23. 2. Create a Test
- Create a basic test from a manual test case.
- Run a test and check for errors.
- Store the test file.
- Discuss the importance of initial and end conditions.
24. The User Interface
- The QuickTest Professional user interface is broken up into a number of functional areas. You can choose to focus on one or more areas depending on the task you are performing.
25. Record a Test
- Once the record button is pressed and test steps are performed , QuickTest listens and records the activities. 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. For some environments, this is mandatory.
26. 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
- A 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:
- Select your folder
- Type in the test name
- 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 Professionals test directory.
- You have the option to save the test results along with the test.
27. Steps to Run a Test
- From the QTP Toolbar, click on the Run Button.
- A best practice is to use the temporary folder to hold the results while debugging your test.
- Press the OK button to execute the Run command.
28. Viewing the Test Run
- When you run a test, QuickTest performs each step as it was recorded.
- You can watch in the AUT as QuickTest performs each step. A yellow arrow in the left margin of the KEYWORD VIEW points out the step currently running.
- When QuickTest finishes running the test, you can open the Test Results window.
29. Steps to View the Results
- Decide if results must be viewed.
- If yes, select TEST->RESULTS from the QTP menu bar.
- View the outcome of the test run.
- Expand the results tree. From the Test Results menu bar, select
- VIEW->EXPAND ALL
30. 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.
- Navigate to the child step that caused the failure.
31. 3. The Object Repository
- Define what a Quick Test Professional object is.
- Describe the role of the Object repository
- Identify a given object as part of a class.
- Describe how objects are recognized by Quick Test Professional.
- Use the Object Repository to find and add objects.
- Change object logical names using the Keyword View.
32. Object Types
- A Quick Test Professional object is a graphic user element in an application, such as a button or a drop-down list.
- Objects are categorized into classes. Buttons, Graphic Images and Edit Boxes are a few examples of class types.
33. QuickTest Object Properties
- In the example above, there are several objects called Buttons, two of which are:
- Update Order
- Delete Order.
- The only way to distinguish one object from the other of the same class is by the difference in object characteristics. Specific characteristics of an object within QuickTest are called object properties.
34. QuickTest Recognizes Objects
- QuickTest uses a method when it learns objects during the recording process.
- QuickTest first looks at the object you are recording and stores it as a test object, determining its object class. For example, QuickTest might classify the test object as a standard Windows dialog box or a web button.
- For each object class, QTP has a default set of properties that it always learns.
- Usually, only a few properties are needed to uniquely identify an object.
35. Assigning a Logical Name
- After learning the class and properties of an object, QTP assigns a name to the object. This is known as the objects logical name.
- QTP refers to the object in a recorded test by using its logical name.
- Edit the logical name to make it more descriptive if you wish.
- The logical name given to an object during recording may be sufficient, but changing a logical name can give clarity to the test and the documentation that is generated.
36. Stored Test Objects
- Recorded object properties are stored in QTPs Object Repository.
- Each test has its own Object Repository, by default..
- These stored objects are referred toas Test Objects.
- The purpose of a Test Object is to represent application objects in the test.
- During a test run, QTP uses the Test Object to search for a match in the application during run time.
37. Steps to change A Logical Name
- You can change an objects logical name in the OBJECT REPOSITORY.
- Right-click on the object at the KEYWORD VIEW level.
- Choose OBJECT PROPERTIES.
- Click on the REPOSITORY button.
38. The Object Properties Dialog
- Once in the Object repository:
- Right-click the object in the repository tree.
- Choose RENAME.
- Type a descriptive name for the object.
- Click OK.
39. QuickTest Documentation
- QuickTest updates the object name and documents it in the documentation field ofthe Keyword View.
- IMPORTANT: if you start a brand new test, the test will record the original, default object names in the Object Repository.
40. 4. Synchronization
- 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.
41. 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.
- The user/test waits for a visual indication that a step has completed so that the user/test can take the next step.
42. How to synchronize the Test
- We can synchronize the test by
- 1.Inserting a synchronization point
- InsertStepSynchronization point
- Window(Flights).WinButton(Update order).WaitPropertyenabled,1,1000
- 2.Adding Exist and Wait statements
- status=Window(Flights).Dialog(Flights Table).Exist
43. Some Visual Cue Examples
- Synchronization point enables the anticipated time problems between the application and QTP.
- A progress bar reaches 100% completion.
- A status message appears.
- A button becomes enabled.
- A window opens and is ready for data entry.
- A pop-up message appears in response to an operation.
44. Examine the Application
- Quick Test defaults to allocating the same amount of time for every object.
- Wait times often occur before an object becomes available for the next step. For example, in the Flights application, once the Insert Order button has been clicked, a process bar must complete to yield the Order No. associated with the reservation. The process bar may require additional time before the test can proceed. If insufficient time is allocated for these special circumstances, the test may fail.
- 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.
45. Add a Synchronization Step While Recording
- Synchronization points which instruct QuickTest to pause until an object property achieves a specific value. The easiest method is to add a synchronization point while recording.
- A Synchronization step can be added manually after a test is recorded , as well.
- Always add the synchronization point immediately after the step to be synchronized.
- From the QTP menu bar, choose INSERT STEP SYNCHRONIZATION POINT
46. 5. 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
47. Object Repository Logical Name Properties 48. OR: Object identification default properties 49. ResourcesObject Repository Can add a New Object to the repository More properties for recognizing the object can be added to the list. The value of property can be edited here. 50. ResourcesObject Repository Manager 51. ResourcesAssociate Repositories Add shared Repository 52. ResourcesObject Repository Associate repository is added to the Filter option. 53. Object RepositoryMerging tool Secondary Repository Primary Repository . 54. Object RepositoryComparison Tool Comparing two repositories' 55. 6. 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.From Menu
- InsertCheckpointStandard Checkpoint
- 2.From Keyword view
- 3.From the Active Screen
56. Checkpoint Types 1.Standard Checkpoint 2.Image Checkpoint 3.Table Checkpoint 4.Page Checkpoint 5.Text Checkpoint 6.Text Area Checkpoint 7.Bitmap Checkpoint 8.Database Checkpoint 57. 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.
- Right-click on the appropriate field and choose Insert Standard Checkpoint.
58. Regular Expressions
- Regular expressions enable Quick Test to Identify Objects and text strings with varying values.
59. Use a Regular Expression
- A regular expression is a string that specifies a complex search phrase. By using
- special characters you define the conditions of the search.
- Note: There are 4 steps to ensure that a regular expression is inserted correctly.
- From the Checkpoint Properties window, ensure Constant is enabled and click on the note paper icon.
- Check Regular Expression checkbox.
- IfQTP sees there are characters that can be misconstrued as a regular expression, it will ask you to treat it as a literal character. Generally, you will answer No.
- Add the regular expression. For example, Figure 6-6 will use [A-Z a-z]+.
60. 7. Parameters
- Describe and use multiple parameter types.
- Drive data in multiple iterations.
- Analyze errors during iterations.
- Parameterize a checkpoint.
61. 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. Data driving allows one script to test application functionality with many sets of data.
- Automated data driven testing frees you to perform more tests, thus increasing test coverage. Speed, repeatability, free resources to do other kinds of quality control.
62. Input Parameter
- Input Parameters allow you to replace a static, recorded value in a step with a dynamic placeholder (parameter), which represents an expandable range of values.
- Input parameter names and their values are located in QuickTests Data Table.
- Input parameter values are input into the application from some outside data source.
63. 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.
- From the Value column, click on the current value.
- Click on the parameterize button.
- The Constantvalue appears in the Value Configuration Options dialog box.
64. Set the Parameter Value
- In the VALUE CONFIGURATION OPTIONS dialog, select the Parameter radio button and ensure that Data Table is selected from the drop-down list.
- From the Name drop down list, enter a unique column name to create a new column in your data table or choose an existing column name from the data table.
- Use the default Global data sheet to store values.
- Enter the values that QTP will input after the test executes.
65. Supply Data to the Parameter
- The design-time table is the central location for storing input parameter values.
- The number of rows in the data table will cause the same number of test execution iterations to be run.
- As a default, the design-time data table is 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.
66. 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.
- Expand the tree for each iteration (Row#) to view specific information about the execution of the specific row.
67. 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.
- A checkpoint on a parameterized field.
68. A Test with Multiple Actions
- Actions can be divided into logical sections, like the main sections of a transaction, or by specific business processes.
- When you create a new test, it contains one action. By dividing your tests into multiple actions, you can design more modular and efficient tests.
69. Types of Actions
- There are two kinds of actions:
- Regular (Non-reusable)
- Tests that contain reusable actions can be used:
70. 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. The Insert New Action window appears.
- Or use the lego icon on the toolbar to insert new action.
71. Using Parameterized Data
- Test data can be passed from one test to another test using the value of an input parameter.
- This creates a data flow between business processes.
- The value passed from one business process to another will come from the Data Table.
- Be aware of any data dependencies that occur within the business process.
72. Copied, 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
73. Set Actions as Reusable
- Create a reusable action from the Action properties dialog.
- Check the checkbox and click OK. A message will appear stating a description of a reusable
74. Call An Action
- You can donumber of things with a reusable action, such as:
- Call it multiple times within a test.
- Call it from other tests.
- 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)
- as local editable copy
- use the (read only) data from the original
- Insert copies of non-reusable actions into your test, but you cannot insert calls to non-reusable actions.
75. One Action used Many Times
- Rather than recording the login process three times in three separate tests, and enhancing this part of the script (with checkpoints and parameterization) separately for each test, you can create an action that logs into the application in one test.
- Best Practice
- Inserting calls to existing actions makes it easier to maintain our tests; when an object or procedure in your application changes. It only needs to be updated one time, in the original action.
76. Set Actions as Reusable
- Create a reusable action from the Action properties dialog.
- Check the checkbox and click OK. A message will appear stating a description of a reusable action.
77. On Action Two Names
- Use the Action Properties General tab to modify the default label.
- This makes the test easier for others to understand when viewing the test from the Keyword View tree.
- Right-Click on Action and enter a logical name for the business process.
78. External Action Properties
- An external action is a reusable action created in another test. The external action is inserted into the calling test in a read-only format.
- Data from the external actions data sheet can be imported as a local, editable copy or kept as read only. If read-only, the data can only be modified from the original test.
- After a reusable action is called, 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.
79. 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.
- Right-Click on the Action label in the Keyword View, and choose Action Call Properties from the list provided.
80. Defining an Action
- The Action Properties dialog box enables you to define options for the stored action.
- You can modify an action name, add or modify an action description, and set an action as reusable.
81. 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.
82. 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.
83. The Test Flow List
- The Test Flow List:
- - Changes with the addition of a reusable action.
- - Enables viewing of the action tree for a selected reusable or external action.
- The test flow appears when a test is recognized as having called actions in your test.
- An action tree displays all the details of the selected reusable or external action.
84. Action Data Structure
- In the Action data structure, each Action will have its own:
- Folder with an object repository
- Local data table sheet
- Run settings
85. Multiple Reusable Actions
- When using multiple, reusable actions, keep the following in mind:
- Actions can be called or copied from another test.
- Run settings have to be set per action
- As a default, all actions in a test use the same shared Object Repository.
- 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.
- Position your action calls separately or nest them with other actions.
86. Delete an Action
- Because reusable actions can be used throughout your test or test set, when you delete an
- action, you must decide to delete a specific occurrence of the action and/or all of its calls .
A different message appear when you are about to delete a non-reusable action. 87. 8. 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 sheetduring each global iteration at run-time.
- Provides a source of values that can be seen and used by any action.
88. Data Table Sheets - Local
- When a Local Data Sheet is used:
- The parameters and data will appear with different tabs in the main calling tests Data Table.
- It allows you to iterate reusable actions independently of any other called actions.
- You will need to link parameters in the main calling test
89. 9. Recovery Scenarios
- To instruct Quick test to recover from unexpected events and errors that occur in the testing environment during the run session.
- A Recovery scenario consists of
- a) Trigger Event
- b) Recovery Operation
- c) Post Recovery Run Option
90. 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.
91. Recovery Scenario Wizard 92. 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.
- Types of Programmatic descriptions
- a) We can list the set of properties and values that describe the object directly in a test statement.
- e.g: Dialog(name:=Login).WinEdit(attachedtext:=agentname).Setimpetus
- b) We can add a collection of properties and values to a description object and then enter the description object in the statement.
- Set myobject=Description.Create()
- myobject(html tag).value:=a
- Dialog(name:=Login).WinEdit (myobject).Setimpetus
93. QTP: Object Repository, Descriptive Programmingand Beyond 94.
- 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 objects logical name. To do this you 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
10. Enhance TestCases With Descriptive Programming 95.
- You can describe an object directly in a test statement by specifying property : = value pairs describing the object instead of specifying an objects logical name.
- TestObject(PropertyName1:=PropertyValue, , PropertyNameX:=PropertyValueX)
- Where Test Object is test object class
- PropertyNameis PropertyValue
- i.e. the test object property and its value . Each property:= value pair should be separated by commas and quotation marks.
- For Example: Window(Text:=Myfile.txt-Notepad).Move 50,50
- If you want to use the same programmatic description several times in one test, you may want to assign the object you create to a variable.
- For Ex:- Set MyWin := Window(Text:=Myfile.txt-Notepad)
- MyWin.Move 50,50
Enter Programmatic Descriptions Directly into Test Statements 96.
- Once we have filled the Properties collection with a set of Property objects (propertiesand values), you
- Can specify the Properties object in place of a logical name in a test statement.
- For Ex:-(Instead of Entering)
- Window(Error).WInbutton(text:=OK, width:=50).click
- IF Entered
- Set MyDescription= Description.Create()
Contd. 97. VB Script basics Data Types 98. 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
99. VB Script basics - Operators 100. VB Script basics Conditions & Looping
- Conditional Statements
- If...Then...Else statement
- Select Case statement
- Do...Loop: Loops while or until a condition is true.
- While...Wend: Loops while a condition is true.
- For...Next: Uses a counter to run statements a specified number of times.
- For each...Next: Repeats a group of statements for each item in a collection or each element of an array.
101. VB Script basics Functions 102. Key areas in QTP
- About the script structure
- Actions (Simple, Nested, External, Re-usable)
- Parameterization (Different Types)
- Checkpoints (Programmatic Methodology)
- Descriptive programming
- Adv. Synchronization points
- Exception Handling
103. About the script structure 104. Actions (Simple, Nested, External, Re-usable)
- Standalone Actions
- Nested Actions
- Integration of Actions (Call from One Action to other)
- Driver Action (Main Action)
- Re-usable Actions
- External Call for Actions
- Classifications of Parameterization
- Test and Action Parameters
- Data Table (Global & Action Specific)
- Environment variables
- Random Number
106. Types of Checkpoints Standard CheckpointChecks values of an objects propertiesCheck that a radio button is selected.Image CheckpointChecks the property values ofan imageCheck that the image source file is correct.Table CheckpointChecks information in a tableCheck that the value in a table cell is correct.Page checkpointChecks the characteristics of a Web pageCheck how long a Web page takes to load or if a Web page contains broken links.Text /Text Area CheckpointChecks that a text string is displayed in the appropriate place in a Web page or application windowCheck whether the expected text string is displayed in the expected location on a Web page or dialog boxBitmap CheckpointChecks an area of a Web pageor application after capturingit as a bitmapCheck that a Web page (or any portion of it) is displayed as expected. 107. Cont. Database CheckpointChecks the contents of databases accessed by an application or Web siteCheck that the value in a database query is correct.Accessibility CheckpointIdentifies areas of a Web siteto check for Section 508 compliancyCheck if the images on a Web page include ALT properties, required by the W3C Web Content Accessibility Guidelines.XML CheckpointChecks the data content ofXML documentsNote: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. 108. Descriptive Programming Samples
- Descriptive programming
- Entering Programmatic Descriptions Directly into Statements
- Browser("Mercury Tours").Page("Title:=Mercury Tours").WebEdit("Name:=Author", "Index:=3").Set "Mark Twain"
- Using Description Objects for Programmatic Descriptions
- Set MyDescription = Description.Create() MyDescription("text").Value = "OK" MyDescription("width").Value = 50 Window("Error").WinButton(MyDescription).Click
109. Adv. Synchronization Points
- Using tool menu options
- Wait property
- Wait & exist
110. Exception Handling
- Recovery Scenario Concepts
- Recovery Process
- Trigger Events
- Recovery Operation
- Post-recovery Operation
111. Sample Script QTP Functions
- 'sample 1 - Getting all the items from the combobox
- My_Cnt = Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount
- msgbox My_Cnt
- For i = 1 to My_Cnt
- ' the combobox item index will start from zero.
- My_item = Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i-1)
- Msgbox My_item
- 'sample 2 - Getting the entire content of the combobox
- Var_Content = Window("Flight Reservation").WinComboBox("Fly From:").GetContent
- Msgbox Var_Content
112. Sample Script QTP Functions
- 'sample 3 - Selecting an item from the combo - Using Index
- Window("Flight Reservation").WinComboBox("Fly From:").Select(5)
- 'sample 4 - Selecting an item from the combo - Using Value
- Window("Flight Reservation").WinComboBox("Fly From:").Select("London")
- 'sample 5 - Selecting an item from the combo - Using Variable
- Var_Item = "Zurich"
- Window("Flight Reservation").WinComboBox("Fly From:").Select(Var_Item)
- 'sample 6 - Getting the value of selected item
- Var_Sel = Window("Flight Reservation").WinComboBox("Fly From:").GetSelection
- Msgbox Var_Sel
113. Sample Script QTP Functions
- ' Some FUM's (Frequently Used Methods)
- Var_Text = Window("Flight Reservation").WinEdit("Name:").GetROProperty("AttachedText")
- Msgbox Var_Text
- Var_Enab = Window("Flight Reservation").WinEdit("Name:").GetROProperty("Enabled")
- Msgbox Var_Enab
- If Window("Flight Reservation").WinEdit("Name:").Exist(5) Then
- Msgbox "The Editbox exists"
- Msgbox "The Editbox does not exist"
- End if
114. Object Repository vs. Descriptive Programming what to use?
- There really is no best way
- Use the method that gives your company the best ROI, whether that be Object Repository (OR), Descriptive Programming (DP) or a mixture of both
115. OR Pros and Cons
- 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
- Additional layer to maintain
- Unnecessary objects can be created
- Multiple users cannot concurrently save/write to the shared OR
- It wont eliminate the need for Descriptive Programming in most of cases
116. DP Pros and Cons
- Its a white box
- Compatible with different QTP versions
- Code portability is high
- Easy to mass update
- 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
117. 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
118. Object Repository Logical Name Properties 119. OR: Object identification default properties 120. 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
121. Script playback using Descriptive programming
- QTP searches the Application Under Test (AUT) for the Object using Descriptive properties and performs user action
122. Descriptive programming when and why?
- Consider using DP in following cases:
- Dynamic object properties
- Example: Link Logout
- 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
123. Different ways to work with objects 124. Different ways to work with objects Example for Passenger 1 First Name 125. ChildObjects method using Collection Object 126. ChildObjects method using Collection Object Last Name fields are populated 127. TO, RO and .Object
- .GetROProperty property refers to the AUT Object property (Run-time)
- .GetTOproperty/SetToProperty refers to the properties stored in OR
- .Object.< property/method>refers to the AUT ObjectNATIVEproperties/methods
128. Better names for Object Spy radio-buttons Run-Time NATIVE Object Run-Time QTP (Test) Object 129. Object Run-Time Properties from AUT (GetRoProperty) 130. Run-Time Native Object Properties/Methodsfrom AUT (.Object) 131. Test Object Properties from OR Set/GetToProperty 132. Regular Expressions in OR Example: Server independent Page object 1. Click on Property value to access RegEx 2. Click RegEx Icon 133. Regular Expressions in OR 134. Regular Expressions in OR RegEx icon 135. Object Smart Identification
- Smart Identification is not Artificial Intelligence
- SI uses loose/unreliable object recognition
- Its recommended to disable SI for each and every page/window/control using the Tools->Object Identification dialog (Recording)
- Another way to disable SI: File -> Settings -> Run -> Check the "Disable Smart Identification during run session" check box (Run-Time)
136. Smart Identification (SI) Recording Options SI Checkbox 137. Smart Identification (SI) Run Option SI Checkbox 138.
- Thank You
Kuldeep Sharma (185459) Mobile : +919999732800 | www.hcl.in HCL Technologies Ltd. [email_address]