Solmar QTP0100 Sample


Published on

Published in: Education
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Solmar QTP0100 Sample

  1. 1. Chapter 5 Introduction to Test Objects Chapter Topics  What is an Object?  Object Properties  Object Methods  The Object Spy  How QTP identifies objects?  The Object Repository QTP0100-5.001
  2. 2. QTP0100 - First Steps - Windows What is an Object?  In strictly mathematical branches of computer science the term object is used in a purely mathematical sense to refer to any "thing".  Something that is perceived as an entity and referred to by a name Object Properties QTP0100-5.002
  3. 3. QTP0100 - First Steps - Windows What is an Object Property?  A property of an object is some quality of that object. A physical property is any aspect of an object or substance that can be measured or perceived. Object Methods What is an Object Method?  A method usually consists of a sequence of statements to perform an action, a set of input parameters to customize those actions, and possibly an output value.  Methods are associated with a particular object. QTP0100-5.003
  4. 4. QTP0100 - First Steps - Windows Object Spy Windows Objects QuickTest recognizes objects in an supported application and determines what type of object each is The Object Spy  Using the Object Spy pointing hand mechanism, you can view the supported properties and methods of any object in an open application.  As you move the pointing hand over the objects in the application, their details are displayed in the Object Spy. QTP0100-5.004
  5. 5. QTP0100 - First Steps - Windows  These details may include the test object's hierarchy tree, its properties and values, and the methods associated with the object. Choose Tools > Object Spy or click the Object Spy toolbar button to open the Object Spy dialog box and display the Properties tab. QTP0100-5.005
  6. 6. QTP0100 - First Steps - Windows Understanding the Object Spy Dialog Box  Using the Object Spy, you can view the run-time or test object properties and methods of any object in an open application.  You use the Object Spy pointer to point to an object.  The Object Spy displays the selected object's hierarchy tree.  It displays the run-time or test object properties and values of the selected object in the Properties tab.  It displays the run-time or test object methods associated with the selected object in the Methods tab. Task - Spying Objects  Open and login to the Flight Reservation application.  Be sure that the form is empty of data.  In QuickTest, open the object Spy.  Select the WinComboBox "Fly From" with the Spy finger point.  Answer the following : o How many items does the list have? o What kind of Test Object is the list parent? o What is the second item in the list? o Which item is currently selected? o How many arguments have the method Select? o What is the purpose of the GetSelection method? Object Identification Properties  Object identification properties can be used in the object repository description, in programmatic descriptions, in checkpoint and output value steps, and as argument values for the GetROProperty method.  GetROProperty - Returns the current value of the test object property from the object in the application. QTP0100-5.006
  7. 7. QTP0100 - First Steps - Windows Displaying Messages during the Run Session Use the MsgBox VBScript function in your test to display information during the run session. The run session pauses until the message box is closed. Use the Print Utility statement in your test to display information in the QuickTest Print Log window while still continuing the run session. QTP0100-5.007
  8. 8. QTP0100 - First Steps - Windows Interactive Quiz - How am I? I am a Win______________________ I am a Win______________________ I am a Win______________________ I am a Win______________________ I am a Win______________________ Common Methods and Properties How QTP Identifies Objects? In the Object > Method > Value model, how do you think QuickTest came up with “Fly From:?” QTP0100-5.008
  9. 9. QTP0100 - First Steps - Windows Discussion: How QuickTest Recognize Objects The Object Repository The Object Repository – The hidden object.  When QuickTest runs a test, it simulates a human user by moving the pointer over the application, clicking objects, and entering keyboard input.  Like a human user, QuickTest must learn the interface of an application to be able QTP0100-5.009
  10. 10. QTP0100 - First Steps - Windows to work with it.  QuickTest does this by learning the application's objects and their corresponding property values and storing these object descriptions in an object repository.  The Object Repository window displays a tree of all test objects and all checkpoint ( 9.5 only ) and output objects in the current component or in the selected action including all local objects and all objects in any shared object repositories associated with the selected action. Tree Structure and Logical Names  For each object you select in the tree, the Object Repository window displays information on the object, its type, the repository in which it is stored, and its object details.  Local objects are editable (black); shared objects are in read-only format (gray).  You can use the Object Repository window to view the object description of any Test object in the repository. Recording a Script Based on the Instructor Presentation. How QTP Identifies Objects  Learns the object's parent window and the object properties...  Recognizes the object type ( class name ).  Collect unique physical properties for that object.  Assigns a "Logical name" to the learned object. QTP0100-5.010
  11. 11. QTP0100 - First Steps - Windows "Playing" a script Based on the Instructor Presentation.  When the script is run, the process is reversed.  The Object Repository translates logical names into physical descriptions.  There is no link between the logical names appearing in the script and the objects in the AUT besides the one created by QuickTest in the Object Repository.  So, all communication, both when recording and when running, passes through the Object Repository. Logical Names  Even if QuickTest has already learned the majority of GUI objects in the AUT, It is quite possible that at a later stage of development there will be new objects in the AUT that should be learned.  Logical name must be identical in repository AND in test script, otherwise script won't run correctly QTP0100-5.011
  12. 12. QTP0100 - First Steps - Windows Summary In this chapter you learned about:  property is a set of characteristics that define an object’s appearance, values, state and identity in an application  A Method is a procedure or process for attaining an object.  Objects have common and/or specific properties and methods, that's why that the most important property is the object type  With the Object Spy you can overview test or run time properties and method of a specific object  The Object Repository is one or more reusable file which maps logical names to a physical description  Logical names are important for readability  Physical descriptions are important for locating objects  QuickTest creates an object repository while it records  Objects are accessible from the object repository Review Questions Question 1 What are the two most important properties for a testing object? 1. _________________________________________________________________ 2. _________________________________________________________________ Question 2 Which Test object will never have a parent? _________________________________ Question 3 The click method is used by almost all testing objects. Why the method does have 2 optional arguments? ( x and y ) ______________________________________________________________ ______________________________________________________________ Question 4 Where the click method is going to "click" without x and y coordinates? ____________________________________________________________________ QTP0100-5.012
  13. 13. QTP0100 - First Steps - Windows Question 5 Which method is used to retrieve Object identification properties? 1. GetContent. 2. GetTOProperty. 3. GetROPrperty. 4. ItemsCount 5. Both 2 and 3 6. None of the options above. Question 6 The drop-down list is represented by the test object: 1. WinList 2. WinDropDownList 3. WinObject 4. WinComboBox. Question 7 The object spy can be activated from: 1. The Tools menu. 2. The Tools toolbar. 3. The Local Object Repository. 4. The Object Repository Manager. 5. All options above. 6. Options 1 and 2. Question 8 What is the difference between an Object Logical Description and Object Physical Description? ______________________________________________________________ ______________________________________________________________ Question 9 Logical names in repository must identical to script object names True False QTP0100-5.013
  14. 14. QTP0100 - First Steps - Windows Exercise: Identification Properties Part 1 - Open the Basic Script  From menu File > Open > Test  Select QTP0100_1 Part 2 - Handling Dynamic Data  In The Flight Reservation application press on the New button or File > Menu print the number of items in the dropdown list Fly to:  Run the script.  Why two different methods return the same value? __________________________________________________________________  After the Step "Select London" ( Fly From ) Step, print again the number of items on the dropdown list Fly to:  Run the script.  Why the values are now different? __________________________________________________________________  After the Step Select "London", print the "enabled" value of the Flights button.  After the Step Select "Paris", print the "enabled" value of the Flights button.  Put in the right location within the script to print the "enabled" identification property of the button "Insert Order" to be True  Print the final message in the progress bar ( "Insert Done..." )  Run the script and describe your conclusions : __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ __________________________________________________________________ Part 3 - Investigating the Object Spy  Open the Flight Reservation application if it closed.  Login to the Flight Reservation Application. QTP0100-5.014
  15. 15. QTP0100 - First Steps - Windows  Enter Date: "010110", Fly From: "Seattle".  Activate the Object Spy.  Spy the test object "Fly From:"  What is the value of the identification property all items? __________________________________________________________________  What is the value of the selected property? __________________________________________________________________  What is the value of the text property? __________________________________________________________________  What is the difference between them (selected and text)? selected: __________________________________________________________ text: ______________________________________________________________  Spy the test object "Fly To:"  What is the value of the selected property? __________________________________________________________________  What is the value of the text property? __________________________________________________________________  Close the Spy.  Minimize the Flight Reservation application.  Activate the Spy again.  "Spy" on the Flights button.  Retrieve the identification property of the Flights button?  Why the text property value different from the actual text value? __________________________________________________________________ __________________________________________________________________ Part 4 - Runtime Properties  Spy on the object "Name:" and answer the following:  How many run-time object properties "Name:" has? ______________________  How many run-time object methods "Name:" has? _______________________  "Spy" on the Date of Flight field ( ActiveX object ) and answer the following:  How many run-time object properties "MaskEdBox:" has? ________________  How many run-time object methods "MaskEdBox:" has? __________________ QTP0100-5.015
  16. 16. QTP0100 - First Steps - Windows Part 5 - The Object Repository  Open the Object Repository form the basic test ( CTRL + R )  How many "Dialog" test objects do you see? __________________________________________________________________  Locate the "Fly From:" test object.  Who is the "parent" of "Fly From:"? __________________________________________________________________  Why we don't see the identification properties" text" and "items count"? __________________________________________________________________ __________________________________________________________________  Locate the "Date of Flight" field  Why logical name is not "Date of Flight"? _____________________________  How many "OK" buttons you see in the object repository? ________________  If you find more than one, what is the difference between them? __________________________________________________________________ __________________________________________________________________  Why the WinRadioButton "Economy" is not in the OR? __________________________________________________________________ __________________________________________________________________  The "native class" value of the t "Fly To:" test object is WinComboBox . True False  The "class" value of the "Fly To:" test object is WinComboBox. True False QTP0100-5.016