Facebook

Course Name Start Date Time Duration Registration Link
No Training Programs Scheduled ClickHere to Contact
Please mail To sudhakar@qtpsudhakar.com to Register for any training

Thursday, April 8, 2010

Descriptive Programming for Virtual Objects

When the application is having objects that are unable to identify by QTP then we will be using the concept virtual objects. We can create virtual objects using Virtual Object Manager. That created virtual objects will be stored as a VOT file in <QuickTest installation folder>\ dat \ VoTemplate. If we want to use those virtual objects in another machine or If we want to use the scripts which are using virtual objects in different machines, then We must copy the .VOT files to the machines where you want to run. Here it will become a maintenance problem. If we forgot / neglect to do that then the scripts will not work.
Descriptive Programming for Virtual Objects is the best solution to overcome this problem. In this you need not create any objects using virtual object manager. The Virtual Objects uses the properties x, y, width and height. All you need to do is you have to mention these properties & property values in script.
For example, in the below script I have virtually created a button under a page. If i execute this automatically that particular area will be highlighted. For this I haven’t created any virtual object using Virtual Object Manager.

strCookie = Browser("Browser").Page("Page").Object.cookie
Note: You can also use the Browser Test Object's GetCookies method to retrieve cookies for a specific URL. For example:
Msgbox Browser("Yahoo").GetCookies(http://finance.yahoo.com)

So now I can run this script on any machine without considering VOT files. You can even store the object information in description object and use that description object in script.

Set oVirtualDescription=Description.Create
oVirtualDescription("x").value=698
oVirtualDescription("y").value=128
oVirtualDescription("height").value=18
oVirtualDescription("width").value=41
Browser("name:=Google").Page("title:=Google").VirtualButton(oVirtualDescription).highlight

There is no facility to create VirtualEdit. We can do descriptive programming for the classes which can be created using Virtual Object Manager. The thumb rule for Virtual Objects Descriptive Programming is we have to use the properties that QuickTest learns for the virtual objects in to object repository.

For Virtual Lists you need to use one more property "rows:=number" and use "rows:=number", "columns:=number" for virtual table. 

17 comments :

  1. Sudhakar,Without the VO definition files, how would this concept be applied to VirtualList (select method), VirtualEdit (set method) etc.? In other words, how would this concept be extended to allow selecting a value from a List that is hidden to QTP, or set a value to a Textbox in the same manner? In the other post, you mentioned that a Virtual Object uses the properties Name, Height, Width, X, Y. This is true to an extent, because the Name is the name assigned by QTP and does not represent itself as a defining property. You might need to add these limitations so readers are not confused as to what is truly possible through this approach.Also, since you're tied to using coordinates, how would this be any different from referring to the target object as a generic object (WinObject) and using coordinates for it to work instead of using a VirtualObject? (as posted on SQAForums: <a href="http://www.sqaforums.com/showflat.php?Cat=0&Number=622737&page=0&vc=1&PHPSESSID=#Post622737">link</a>

    ReplyDelete
  2. Sudhakar Reddy KakunuriApril 17, 2010 at 8:24 AM

    Anshoo,There is no facility to create VirtualEdit. We can do descriptive programming for the classes which can be created using Virtual Object Manager.The thumb rule for Virtual Objects Descriptive Programming is we have to use the properties that QuickTest learns for the virtual objects in to object repository.For Virtual Lists you need to use one more property "rows:=number" and use "rows:=number", "columns:=number" for virtual table.Low level recording is useful for windows applications but not for web. When you want to create a virtual object in side an object of a web page, Low level recording is not suggestible. Because it treats the total web page as a win object. But you want to create in this hierarchy Browser("").Page("").Image("").VirtualButton("").clickIf you use low level recording it will be Window("").WinObject("").VirtualButton("").clickVirtual Objects are more understandable and reliable than Low Level recording. Because we can create them with different hierarchies.

    ReplyDelete
  3. [quote]For Virtual Lists you need to use one more property "rows:=number" and use "rows:=number", "columns:=number" for virtual table.[/quote]I tried several ways of doing this but without the VO data files, QTP will not select any value from the list.[quote]Virtual Objects are more understandable and reliable than Low Level recording. Because we can create them with different hierarchies. [/quote]Certainly more understandable, but can you please explain how this would be a reliable approach? Is it really reliable to use coordinates or an object's width/height to define any object in the AUT?[quote]When you want to create a virtual object in side an object of a web page, Low level recording is not suggestible. Because it treats the total web page as a win object. But you want to create in this hierarchy Browser("").Page("").Image("").VirtualButton("").click[/quote]This is quite true from a usability point of view. [quote]Virtual Objects are more understandable and reliable than Low Level recording. Because we can create them with different hierarchies. [/quote]Don't think I understand this.. How are they more reliable since both rely on the same concept of object recognition - ofcourse, with different object hierarchies.

    ReplyDelete
  4. Hi Sudhakar
    Am using a Evaluation version of QTP 11 to identify if it works for window Based JAVA application.

    My application make use of SWT Nebulla Widgets and QTP is only identifying a Java Object but not all the objects within Class "SWT_Window".
    To solve this issue I tried to use SWT extensibility option of QTP 11.
    There are some built in extension files in installation path of QTP i.e. c:\Program Files\HP\QuickTest Professional\bin\java\classes\builtin

    I copied those files to c:\Program Files\HP\QuickTest Professional\bin\java\classes\extension.

    NOW I can see this extension(SWT) on starting QTP 11 when add inn window appears on start up, However SWT objects are not getting identified, neither Object Identification option in Tools showing any Test Object classes for SWT.

    I can see all these classes are lying there in mic.jar which is common for all the addins.

    QTP do have a help in the form of QuickTest Java Add-in Extensibility Tutorial but thats more of creating SWT extension from scratch. Do somebody have idea about QTP 11 Extensibility, and tell me accurate steps to add SWT Extension and how can I make use of In build XML(SWT.xml)????

    ReplyDelete
  5. HI Sudhakar.

    could you help me to get the quotation for qtp single user licence..,

    yeturus@gmail.com

    ReplyDelete
  6. hi sudhakar

    i wanna to validate the virtual object . is there any possibilities have to done it . if so kindly help me

    ReplyDelete
  7. hi sudhakar,
    i am using QTP 10 on windows 7.i have saves all my tests in D drive and have saved this path in QTP to lookup for resorces.
    now when i create a VO there is no such VO template file in dat folder.
    what is the problem?

    how can i use the VO which i hv created using VO manager?

    ReplyDelete
  8. hi
    Does QTP 11 suports Windows 7

    ReplyDelete
  9. Nice post Sudhakar, its good to know about the DP for Virtual Objects. This is first time I am using Virtual Objects. Keep going. Thanks

    Chandra.

    ReplyDelete
  10. Thanks to Explain about VO

    ReplyDelete
  11. sudhakar i want to create a virtual object for ms _paint using virtual object manager,after creating VOT how i call this? pls assist me.

    ReplyDelete
  12. Hi Sudhakar,

    Need your help, please guide me. My Scenario is:

    In the website, i have 2 edit fields user and password, but they are not identified as individual standard objects, these 2 objects are embedded in only one object which is identified as winobject.

    1. I have tried using with differend Add-ins, those objects could not be recognized.
    2. I tried using virtual object manager, but couldnot get through.

    Please provide me the solution.
    If any contact number please share it with me

    Thank you.
    Balu

    ReplyDelete
  13. does it DP works on different screen resolution, since there is x and Y coordinate?

    ReplyDelete
  14. Hi Sudhakar,

    Does QTP support SharePoint??

    Vinod Reddy Bojja

    ReplyDelete