Articles On Testing

Wecome to http://www.articlesontesting.com !!!

Articles On Testing

Wecome to http://www.articlesontesting.com !!!

Articles On Testing

Wecome to http://www.articlesontesting.com !!!

Articles On Testing

Wecome to http://www.articlesontesting.com !!!

Articles On Testing

Wecome to http://www.articlesontesting.com !!!

Showing posts with label Object Spy. Show all posts
Showing posts with label Object Spy. Show all posts

Automating Using QTP Day5 Some VbScripting Techniques

Synchronization of the application load with the Script execution :
Wait and WaitRoproperty.
In scenarios wherein the properties of the object changes after some time we use waitproperty.

Object Recognition Mechanism in QTP :

  • Add object in the Object Repository using Object Spy 
  • Creating the same using Descriptive programming.
  • Using the active screen or going into the application and clicking insert new object.
Regular Expression Usage Effectively in the scripting :
After having gone through the Book Ticket scenario in the Flight application . just go into the File menu for Fax order scenario.
Go to file and select Fax the booked tickets.
Select for regular expression option so that the fax order number gets recognised each time on the basis
of this very regular expression
Just put a .* after the point from where the characters is expected to be changed.

Text Checkpoint :
Checked text, Text Before, After text
Match CAse, exact match,

Text Area checkpoint
is for tabular display for any specific row.
namespace standards in xml.
XML Addins
is required for the XML checkpoints.

Test Objects used by web services.
Strat Transaction end transactionm...
Time frames get retunrned
Generally used foir query time out features related to databasae interactions.
Colon is used to combine multiple statement in one line

Important conecpts in Advanced QTP workaround :

  • Parameterization
  • Checkpoint
  • Synchronization
  • Object Repository
Descriptive Programming  is a technique used when an object property changes frequently.
No Object Repository method is used for object identification.

Static are the necessary properties of an objects.
Methods like SET are used for creating references to the objects actually present in the application.

Let us look into describing the Objects in the application. Do remember the hierarchy of the Parent and child objects. Generally  the approach we follow for the description programming  is coding in the hierarchial manner that an object is recognized by the QTP tool during the course of object identification.

 Login Box Which is a dialog box
 Keep your appplication open, Object Spy tool can be useed to spy onto the objects and highlight and  copy the properties of the required objects.
 Individually search for each of the objects associated properties.
 Always use the two things, class name and the text name genuinely very relevant.

 Below we spy for the Login dialog page properties

Parent Objects :
Set oLogin=Description.Create()oLogin("Class Name").Value="Dialog"
oLogin("text").Value="Login"

 Child Objects :
 For Login Fileds Textbox

Set oUserNam=Description.Create() oUserNam("Class Name").Value="WinEdit"
 oUserNam("attached text").Value="Agent Name:"

 For Password Fields Textbox Set opassword=Description.Create()
 opassword("Class Name").Value="WinEdit"
 opassword("attached text").Value="Password:"

For Button to log on OKSet oOKButton=Description.Create() oOKButton("Class Name").Value="WinButton"
oOKButton("text").Value="OK"

 For Button to log on CancelSet oCanButton=Description.Create() oCanButton("Class Name").Value="WinButton"
oCanButton("text").Value="Cancel"

 Now , let us code using VBScript  to execute the events in the application which is expected to be performed for logging into the application.

InvokeApplication
"D:\Program Files\HP\QuickTest Professional\samples\flight\app\flight3a"
Dialog(oLogin).WinEdit(oUserNam).Type"employee"
Dialog(oLogin).WinEdit(oUserNam).Set "employee"
Dialog(oLogin).WinEdit(oPassword).Set "mercury"
Dialog(oLogin).WinButton(oOKButton).Click


Dynamic Descriptive programming :
InvokeApplication  "D:\Program Files\HP\QuickTest Professional\samples\flight\app\flight3a"
Dialog("Class Name:= Dialog","text:=Login").Winedit("Class Name:=WinEdit","attached text:=Agent Name:").Set "2039"
Dialog("Class Name:= Dialog","text:=Login").Winedit("Class Name:=WinEdit","attached text:=Password:").Setsecure "4ceb5e5216db248fd801b9d8e2364301e4bafec6"


This is how we do descriptive programming to automate the stable working features of an application. Do always take care of the hierarchy of the application.

Object Spy Enhancement In QTP 10.0


Object Spy Enhancements :

1. Object spy to have an option to export all the objects in hierarchy with their properties and methods to a XLS/XML file. And also to have an option to reload this offline. This feature would help for others to analyze a object recognition remotely.

2. Object spy to have the ability to run without QTP. Currently object spy can only be loaded through QTP.


3. Object spy to have an option to disable the Auto spy. Currently hovering on any object displays it properties without the need to click the object. This at time gives poor performance while spying objects.


4. Currently Object Spy button gets disabled when the script is run, one has to launch object repository and then launch Object Spy from there. The Object Spy should enable directly when the script is run.


5. Object Spy Automation capability, so other tools can leverage the same and automate the OR creation based on custom rules.


6. Object spy to have capability to spy on dynamically created objects. E.g. – The search suggestion box on Google.


7. Object Spy to have facility to compare two different objects and show the differences.


8. Object Spy to support XPaths for identifying objects.

Object Spy In QTP

Viewing Object Properties and Operations Using the Object Spy


Using the Object Spy pointing hand mechanism, you can view the supported properties and operations 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. These details may include the test object's hierarchy tree, its identification properties and values, and the operations associated with the object. For operations, the syntax is also displayed. For information about using the run-time object's operations or retrieving the values of its properties, see Retrieving and Setting Identification Property Values and Accessing Native Properties and Operations.

In most environments, you can choose to view the identification properties, the native properties, the test object operations, or the native operations.

To view identification properties, native properties, test object operations, or native operations:

  1. Open your application to the page containing the object on which you want to spy.

  2. Select Tools > Object Spy or click the Object Spy toolbar button  to open the Object Spy dialog box.

  3. Select the details you want to view for the object. For more information, see The Object Spy Dialog Box.

  4. If the objects on which you want to spy have a deep hierarchy, or long property names and values, resize the Object Spy dialog box to view all the information without scrolling.

  5. In the Object Spy dialog box, click the pointing hand  . QuickTest is hidden. As you move the pointing hand over the objects in your application, the objects are highlighted, and you can view their test object hierarchy and properties or operations in the Object Spy dialog box.
  6. Note: Highlighting the object in the application is supported only in some environments.
    For more information on using the pointing hand, see Tips for Working with the Pointing Hand.

  7. Hover over an object in your application. The object is highlighted in the application, and the Object Spy displays the corresponding test object, its properties or operations, and the test object hierarchy tree. You can move your mouse from one object to another in your application (without clicking) to view information on each object.
  8. To view different details about the test object in the Object Spy dialog box, hold the left Ctrl key and click the relevant options in the dialog box.
    To view the properties and operations of another test object currently displayed in the test object hierarchy tree, hold the left Ctrl key and select the relevant test object.

  9. To capture information about a particular object and its parent objects in the Object Spy, click on the object (in your application). The Object Spy displays the test object hierarchy tree and details for the selected object according to the object details tab and object type radio button that are selected.
  10. After clicking on an object, you can change the selected radio button or tab to view additional details.
    To view properties, values, or operations of other test objects currently displayed in the test object hierarchy tree, select that test object in the tree.

QTPs Enhancements

I hope HP would look at few of these seriously and incorporate them in upcoming version of QTP. In case you can think of other enhancements that can be included in the below list contact us here...

Object Spy Enhancements
1. Object spy to have an option to export all the objects in hierarchy with their properties and methods to a XLS/XML file. And also to have an option to reload this offline. This feature would help for others to analyze a object recognition remotely
2. Object spy to have the ability to
run without QTP. Currently object spy can only be loaded through QTP
3. Object spy to have an option to disable the Auto spy. Currently hovering on any object displays it properties without the need to
click the object. This at time gives poor performance while spying objects
4. Currently Object Spy button gets
disabled when the script is run, one has to launch object repository and then launch Object Spy from there. The Object Spy should enable directly when the script is run
5. Object Spy Automation capability, so other tools can leverage the same and automate the OR creation based on custom rules
6. Object spy to have capability to spy on dynamically created objects. E.g. – The search suggestion box on Google
7. Object Spy to have facility to compare two different objects and show the differences
8. Object Spy to support XPaths for identifying objects


IDE Enhancement
9. Ability to
open multiple scripts at one time
10. Project explorer with capability to create folder and organize resource inside them (library files, ORs, recovery scenarios) in them
11. Improved Intellisense for objects created through DotNetFactory
12. Intellisense for VBScript classes
13. Function folding and code folding in the IDE
14. Transition from Design mode to Run mode causes too many flickers in the IDE UI. This needs to be smooth
15. Ability to view code for Test flow in Expert view. This is currently only possible through Keyword view
16. Design time non-syntax error check for issues like Duplicate variable declaration etc
17. Intellisense of current associated libraries in all Libraries. Currently if Lib1 and Lib2 are associated with a Test. The Lib1 will only show Intellisense for Lib1 and not for Lib2. The Test will show Intellisense for both Lib1 and Lib2. This creates difficulty when Lib2 functions need to be called in Lib1
18. Custom Intellisense for parameters. E.g. if a framework creates GetObject method and that takes in keyword which is loaded from a external excel/XML file then to be able to provide Intellisense with those keyword
19. Script workflow diagram, something similar to keyword view but not at statement level but at function and action in flows
20. Ability to search called Actions in current script and go to the same. Current UI is very unfriendly in case too many actions are called in the script
21. Ability to specify
default run results directory and avoid the dialog for run results location for every run. This gets very annoying when debugging the script
22. Input Parameters tab in Run dialog should remember the history of values used last time. Currently if Test/Component parameters are used and for debugging the same parameters value are updated before start the run, these values are lost next time run is initiated. This causes a lot of value update every time the script needs to be run for debugging
23. Ability to pause recording, currently when recording starts it can only be stopped. Having a feature to pause recording would help a lot


Object Repository Enhancements
24. Ability to create and load OR’s from QTP script itself
25. Ability to load Shared ORs dynamically to all the Actions. Currently RepositoriesCollection.Add methods adds the SOR to the current Action only and not other actions
26. Changes made through SetTOProperty in one Action does not get propagated to Next Action
27. Ability to enumerate all child objects present in the OR for a specified object
28. Ability to specify nickname for Objects. This would help get a

complete object hierarchy through just the nick name
29. Ability to directly record objects into the SOR


Object Repository Manager Enhancements
30. Ability to load and save directly to OR in XML format
31. Ability for multiple users to access the Shared OR at the same time for updating
32. Export/Import of Checkpoints from one SOR to another
33. Merging of SOR’s to an existing SOR. Currently when two SOR are merged, the merged SOR needs to be saved as a different file
34. Ability to update code when conflict resolution renames object during SOR merge. In case object A and B are merged and name A is chosen over B, all scripts using name B needs to be updated manually




Lots of stuffs on Automation Testing :