790 likes | 1.09k Views
An Insight to Learn HP QuickTest Professional 10.0. An Advance Guide Valuable Resource for Certification Exam HPO-M39. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<. Topics Covered. Object Repository Type and Object Recognition Shared Object Repository Checkpoints
E N D
An Insight to LearnHP QuickTest Professional 10.0 An Advance GuideValuable Resource for Certification Exam HPO-M39 >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Topics Covered • Object Repository Type and Object Recognition • Shared Object Repository • Checkpoints • Transactions and Step Generators • Exception Handling and Recovery Scenarios • Analysis of Test Results >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition What is an Object Repository ? Object Repository is a collection of objects pertaining to the application under test. Example: All the text boxes, list boxes, images etc are stored in a file in QTP. This file is called the object repository. Each object will have the set of properties to identify that object uniquely in the application. At the time of execution, QTP identifies the objects on the screen by comparing them with the objects and their properties in the repository. We can have any number of Shared Object Repositories associated with an action. In QTP 10.0 all the objects are recorded into the local repository and then we need to export the objects from local repository into the shared object repository by opening the object repository and selecting File Menu and selecting "Export Local Objects". We need to specify the name for the shared object repository in which we want to save these objects. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition • Object Identification • Recording Modes:Context sensitive Mode Low-level Mode Analog Recording Mode • Virtual Objects >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition • Types of Object Repository • Per – action object repository • Shared object repository • Per – action object repository • Default repository • Specific to actions (Will be used only for a particular action) • Preferable when application is not dynamic with respect to time • Cannot be reused >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition • Per – action object repository • Default repository • Specific to actions (Will be used only for a particular action) • Preferable when application is not dynamic with respect to time • Cannot be reused Example Action1 and Action 2 of same test will have different object repositories. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition • Shared Object Repository • Can be updated by all actions accessing it • Preferable when application is dynamic with respect to time • Used in most automation projects • Needs maintenance and administration >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Shared object repository may be common to all tests and to all actions inside each test Shared object repository Test1 Test2 Test3 Action1 Action2 Action3 Action1 Action2 Action3 Action1 Action2 Action3 >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition What is Object Identification? Object identification is a method of instructing QTP to recognize the various objects in the application. Usually QTP can identify the objects uniquely for most of the applications/objects, but for some applications this may not be true. In this scenario we need to tweak the Object Identification settings of QTP to learn extra properties or custom properties defined in the application, for recognizing the objects uniquely. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Go to - Tools - Object identification - and select the environment (windows, web etc). This will give you all the possible type of objects in that environment like Edit boxes, check boxes etc. Select the type of object you have problem recognizing uniquely. QTP will show you the mandatory and assistive properties which are grabbed and used currently for that object. You can select the extra properties which are already defined in the application for that kind of object by clicking on the green "+" sign and selecting the required properties. If you still have the problem of recognition then you need to find out the unique property defined for that object type from the development team and Add that custom property by clicking "New" in the Add/Remove properties window of Object identification. How to do Object Identification in QTP? >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition If you still have the problem of recognition then you need to find out the unique property defined for that object type from the development team and Add that custom property by clicking "New" in the Add/Remove properties window of Object identification. For example if the custom property name is "RefGen", you can click "New" and give the new property name as "attribute/RefGen". When you record next time on that kind of object the new properties will be automatically grabbed. If you want to update the existing objects run the test in the Update Run mode and select the checkbox Update Object Properties.Note: The changes you make in the Object Identification will affect everyone working on that machine. These changes should be applied universally on all the machines you intend to run the regression tests. These are QTP setting changes not the script changes. How to do Object Identification in QTP? >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Object Identification User can specify properties to be used for identification to distinguish between 2 - objects of same class object. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Configuring Mandatory and Assistive Recording Properties: • Mandatory properties: >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Mandatory properties: • QTP haslist of mandatory properties, for each type of object, which it always learns. • When we run the script QTP uses all the mandatory properties to identify the object. It uses assistive properties when mandatory properties are not enough to identify an object. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition • We can change the mandatory properties or assistive properties based on the application. • We can add /remove few properties in mandatory properties or assistive properties so that QTP identifies the object when we run the script >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition • How to change properties of objects? • Tools Object Identification • Object Identification dialog box opens • Select the properties you want to make mandatory or assistive by selecting the option • Options are available to the user • Selected properties will be made mandatory in this case • Selection of properties should be based on nature of application • Same is applicable to assistive properties >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Recording Recording a link… Example… Mandatory Properties: Html tag: Text: Inner Text: Assistive Properties: Coordinate X: Coordinate Y: URL: Color: Font: During recording QTP has stored both the mandatory as well as assistive properties for identifying the particular link. Let us check why? A Testing Testing 256 298 Green Arial >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition During Recording Mandatory Properties: Html tag: Text: Inner Text: Now QTP is able to identify the link with captured 3Mandatory properties and 5Assistive properties!! A Testing Testing Starts using assistive properties and checks object Assistive Properties: Includes 1st Property Coordinate X: 234 Includes 2nd Property Coordinate Y: 286 Includes 3rd Property URL: www.abcd.com QTP uses Assistive properties if the stored Mandatory properties are not enough to identify an object Color: Orange 4th Font: Arial 5th >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Selecting an Ordinal Identifier: • In addition to mandatory properties and assistive properties, QTP records backup ordinal identifier for each test object • Used when QTP is not able to identify an object with captured mandatory properties and assistive properties during recording, In other words, Ordinal identifier is used if mandatory properties and assistive properties captured by QTP is insufficient to identify an object in the application during record session. During a Record Session QTP uses Ordinal Identifier in addition to other captured properties to identify the objects during a record session If mandatory properties and assistive properties are insufficient to identify an object during record session >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Types of Ordinal identifiers: • Index based • Location based • Creation Time Index:Indicates the order in which the object appears in the application code relative to other objects. Eg., pressing a tab and giving numbers to objects Location:Indicates the order in which the object appears within the parent window, frame, or dialog box relative to other objects with an otherwise identical description CreationTime(Browser object only): Indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description. An ordinal identifier is selected by default for each test object class.To modify the selected ordinal identifier, select the desired type from the Ordinal identifier box. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Setting up which ordinal identifier to use during object identification: • User can select which ordinal identifier to be used by selecting the options in object identification • The ordinal identifier in web will have three options namely Index, Location and Creation time. This Creation Time is not available in the ordinal identifier options of other environments. Options for other Environments Options for Web Identifying an Object Using the Index Property: QuickTest can assign a value to the Index test object property of an object The value is based on the order in which the object appears within the source code. The first occurrence is 0. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Identifying an Object Using the Location Property: • During recording, QuickTest can assign a value to the Location test object property of an object in order to uniquely identify the object. • The value is based on the order in which the object appears within the window, frame, or dialog box, in relation to other objects with the same properties. First occurrence value = 0 • Values are assigned in columns from top to bottom, and left to right. Example: Numbered based on location property >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Identifying an Object Using the CreationTime Property : • During recording, QuickTest is unable to uniquely identify a browser object based solely on its test object description, it assigns a value to the CreationTime test object property. • This value indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description. • During the run session, if QuickTest is unable to identify a browser object based solely on its test object description, it examines the order in which the browsers were opened, and then uses the CreationTime property to identify the correct one. Opening a new browser with same application Opening a new browser with an application Example QTP notes the creation time of both browsers as creation time property >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Configuring Smart Identification: • Configuring Smart Identification properties enables you to help QuickTest identify objects in your application, even if some of the properties in the object's recorded description have changed. About Configuring Smart Identification: • QTP uses object description for identifying an object. If its not able to identify the object with the description, then it goes for smart identification mechanism. • Smart identification uses two types of properties and are base filter properties and optional filter properties >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Base Filter Properties: • Most fundamental properties of object class or values which cannot be changed without changing the essence of the original object. Eg., if a Web link's tag was changed from <A> to any other value, you could no longer call it the same object. Optional Properties: • Other properties to identify objects for a particular class as they are unlikely to change on regular basis, but can be ignored if they are not applicable. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Step-by-step Instructions for Configuring a Smart Identification Definition: • Tools > Object Identification. The Object Identification dialog box opens. • Select the appropriate environment in the Environment list. The test object classes associated with the selected environment are displayed in the Test object classes list. • Select the test object class you want to configure. • Click the Configure button next to the Enable Smart Identification check box. The Configure button is enabled only when the Enable Smart Identification option is selected. • The Smart Identification Properties dialog box opens: >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Base filters & Optional filters: • In the Base Filter Properties list, click Add/Remove. • The Add/Remove Properties dialog box for base filter properties opens. • Select the properties you want to include in the Base Filter Properties list and/or clear the properties you want to remove from the list. • Click OK to close the Add / Remove Properties dialog box. The updated set of base filte properties is displayed in the Base Filter Properties list. • In the Optional Filter Properties list, click Add/Remove. The Add/Remove Properties dialog box for optional filter properties opens. Same applies for optional properties also. • Use the up and down arrows to set your preferred order for the optional filter properties. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
MS Paint MS Paint If recorded using Context sensitive mode, You will not get any drawing during playback If recorded using Analog mode, You will be replay it back successfully Object Repository Type and Object Recognition Recording Modes – Context sensitive, Low-level and Analog Recording Context sensitive: • This is the Default mode of recording which takes full advantage of QuickTest's test object model. • Records the objects in your application and the operations performed on them. • Recognizes objects in application regardless of their location on the screen. Analog Recording: • Records the exact mouse and keyboard operations you perform in relation to either the screen or the application window. • QTP’s Analog recording is captured as Tracks and stored in the directory of your test • Useful for recording operations that cannot be recorded at the level of an object. Eg., A signature produced by dragging the mouse in a paint will be recorded in analog recording >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Recording Modes – Context sensitive, Low-level and Analog Recording Low Level Recording: • Enables you to record on any object in your application, whether or not QuickTest recognizes the specific object or the specific operation. • Records at the object level and records all run-time objects as Window or WinObject test objects. • Used when the exact coordinates of the object are important for your tests. • Used when recording tests in an environment (or on an object) not recognized by QuickTest. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Virtual Objects: • Substitutes for standard objects • Used when standard objects cannot be recorded due to problems that arise during recording • Virtual objects coverthe regions in the application that QTP has failed to identify. Scenario: • During recording, QTP can fail to identify certain objects in the application screen. We will not be able to proceed on with recording the remaining part of the script without the line. • Create virtual objects and start recording. That particular part of application will be covered and marked as virtual object in the script. • By creating virtual objects, user can avoid scenarios which may stop automation of a test scenario.E.g..,Try creating a cell in excel sheet as Virtual Object and try recording it and check the script The following example clicks the "button" VirtualButton. Syntax: Browser(“X").Page(“Y").ActiveX(“Z").VirtualObject(“A").Click >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Defining a Virtual Object: • ClickTools > Virtual Object > New Virtual Object • You will get the steps as mentioned below Click Next Next page for next step Class can be Object, Button, Table, List, Check box & Radio button. Mark a class based on the object which is present in his application Eg., Mark radio button from the drop down shown if QTP has failed to identify a radio button in the application during recording a script >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Object Repository Type and Object Recognition Step3 Step4 Click Mark Object button (The QTP screen is minimized) You will get a cross hairs pointer Use the cross hairs pointer to mark the object in application You can select entire parent hierarchy or parent only Step6 Step5 Add virtual object to a collection >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Shared Object Repository >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Shared Object Repository Shared object repository Test1 Test2 Test3 Action1 Action2 Action3 Action1 Action2 Action3 Action1 Action2 Action3 >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Shared Object Repository Same object repository for related functionalities across different actions or scripts It is also possible to add new objects to the existing repository either manually or while recording We can also specify additional properties for objects other than mandatory ones that appear when the objects are captured. Reusability of objects Changes in object properties can be updated directly in the shared object repository model >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Shared Object Repository Implementing Shared Object Repository: The object repository can be managed using a folder containing all the object repositories which have been used throughout the project. Files under this which contain object repositories (which are stored as .tsr files) are stored module wise. Inserting Shared Object Repositories: There are two ways of adding shared object repositories to a test script 1) At design time 2) At run - time Same object repository for related functionalities across different actions or scripts >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Shared Object Repository • Steps to add a shared object repository : • Open the Quick Test script. Go to Test Settings in the menu bar. Select the “Resources” tab in the Test Settings window. • Click on the Shared radio button under Object repository type frame. • Enter the path of the shared object repository in the text box given in the Object repository type frame. Click on Apply button and then click on the OK button. • Now all the actions in this particular script can use the objects present in the added shared object repository. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Shared Object Repository VB Script for creating shared object repository at run-timeOption Explicit On error resume next Dim newApp 'As newApplication declare the Application object variable Dim newObjRepository 'As newObjectRepository 'Declare a Repository Object Variable Dim strObj_Path ' To Set the Shared Object Repository Path ' Open QuickTest and prepare objects variables Set newApp = CreateObject("QuickTest.Application") 'Create the Application object newApp.Launch ‘Start QuickTest newApp.Visible = True 'Make the QuickTest application visible Set newObjRepository = newApp.Test.Settings.Resources strObj_Path = <path of the object repository> newObjRepository.ObjectRepositoryPath = strObj_Path >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Shared Object Repository Releasing Objects When we add object repositories to a test script during run – time, a particular memory space is allocated to each of the object. We release this memory space at the end of each action to enhance the performance of the script. The extract given below is included at the end of each action to release the objects. Set newApp = Nothing ‘Release the Application object Set newObjRepository = Nothing 'Release the object repository object Regular Expressions Regular Expression is similar to the usage of wild card characters in search functionalities. Steps to use regular expression: 1. Go to Tools Object repository in a Quick Test script. 2. Select the Object property of the object that needs to be regularised. 3. Click on the button highlighted in the snapshot given in next page 4. Open the Quick Test script. Go to Test Settings in the menu bar. 5. Select the “Resources” tab in the Test Settings window. 6. Click on the Shared radio button under Object repository type frame. 7. In the Confirmation window that appears, Click on the No button to use “.*” as a regular expression and not as characters. 8. Click on OK button in the Constant Value Options. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Shared Object Repository There are other types of regular expressions that can be used apart from “.*”, such as \ , %, etc. Shared object repository needs Object Repository Manager for managing all the object repositories. The basic function of an ORM is to take back up of the object repositories from time to time to prevent object repositories from becoming corrupt. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Check Points >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Check Points What is aCheckpoint? A confirmation or verification point in which the value of some property which is expected at a particular step is compared with the actual value which is displayed in the application is called a Checkpoint. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Check Points The expected value can be property of an image or web page or a tablewith values displayed in application, portion of text or text displayed in a specified region, a dynamic value displayed in application from database, bitmap of image displayed or dynamic text displayed from XML. Check points are Classified as under: • Standard Checkpoint • Page Checkpoint • Text / Text Area Checkpoint • Image Checkpoint • Database Checkpoint • XML Checkpoint • Bitmap Checkpoint • Table Checkpoint • Accessibility Checkpoint >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Check Points Standard Checkpoint:Standard Checkpoint checks for property value of object displayed in any application. Object can be radio button, combo boxes, drop downs, button, images and links. A user who records a standard check point can select the properties of any property he wishes to check. QTP will check only the fields specified by the user. The value column is stored as expected result and can be modified or parameterised when creating and modifying checkpoint. Expected result If the value in the application is displayed as a table then this check point is called as Table Checkpoint. User can select few values in the table or select all the values as expected value. User also has options to parameterize the values. >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Order Login Print Close Check Points Page Checkpoint:A Standard Checkpoint created for a web page can be called a Page Checkpoint. Page Checkpoint includes checking Load time, number of images or links in a web page, checking every links and images, HTML Source and Tags verification and checking for broken lines. Load time: The time taken by a web page to load. A user who uses this check point can give approximate amount of time that will be required for the page to load so that QTP will fail this checkpoint when page takes more time to load than specified. Number of links and images present in a web page Consider this a web page Process Assets Process DB Reports Prospective Business Module Project Budgeting System Project Setup Proposal Information System QTP Results: No of Links: 6 No of Images: 4 >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Check Points Checking links and images: User can check all the links and images present in his application with the links and images expected with a page checkpoint. Checkpoint results will show the expected and actual result obtained as shown below. HTML Source of a web page and broken lines in a web page can also be checked using a page check point >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Check Points Text/Text Area Checkpoint: Checks the text present in a web page or any application. We can store the expected text that should be present in the application when creating this checkpoint. QTP verifies whether the expected text with the actual text appearing and shows output as shown below. Text Checkpoint can check for case sensitivity, space mismatches and for exact matches. These three options can be configured by the user as shown Expected result is shown in greencolor and actual content that captured in the web application is shown in red color. A text mismatch will be shown as represented above. Options will be provided to the user to export the contents to excel sheet in the same format >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Check Points Database Checkpoint: Compares the dynamic values displayed in the application with the values from the database. User will write a SQL query when creating this checkpoint with which QTP will check the dynamic values displayed in application. Query written in QTP to check random values: Select * from data where company = ‘Software Testing’; Application Software Testing India Total number of Client : 10 Total number of employees: 2500 Total number in onsite : 200 Number in offshore : 3200 Values retrieved from database by QTP Cl_num emp_num on_num off_num 10 2500 200 3200 Dynamic values from database >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Check Points Database Checkpoint: Compares the dynamic values displayed in the application with the values from the database. User will write a SQL query when creating this checkpoint with which QTP will check the dynamic values displayed in application. Query written in QTP to check random values: Select * from data where company = ‘Software Testing Genius’; Application Software Testing India Total number of Client : 10 Total number of employees: 2500 Total number in onsite : 200 Number in offshore : 3200 Values retrieved from database by QTP Cl_num emp_num on_num off_num 7000 10 2500 200 3200 700 Dynamic values from database >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<
Check Points XML Checkpoint: In web application, there will be several places for which data from XML will be displayed . QTP helps in comparing the values in the XML with the values displayed in application and also can validate the schema of XML. • The contents displayed in a web application from XML is checked • Expected input values can be parameterized • XML Schema can also be validated with the checkpoint >>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<