QTP Descriptive Programming Unplugged Book Review

Book Reviews Published on:
Robot Book Reading

One of the most frequent (and most vague) questions I'm asked on my blog is “QTP doesn't recognize an object in my application – what do I do?”

I find myself wishing, rather than going back and forth trying to figure out what the issue is, that there was a book I could point them to.

With the recent release of QTP–Descriptive Programming Unplugged – Master Object Identification Techniques by Anshoo Arora & Tarun Lalwani, my wish has finally come true.

About the Authors of QTP Descriptive Programming Unplugged

The authors are like a wrestling tag team of Hulk Hogan and Randy “Macho Man” Savage. Both are QTP champions in their own right.

Tarun is the author of what I consider to be the best overall book on QTP — QuickTest Professional Unplugged. He's also the moderator of the QTP forums on my favorite test automation forum: SQAForums.

Anshoo is the owner of the popular automation website www.relevantcodes and a big contributor to SQAForums, so you can be sure the information presented in this book is going to help you overcome any tough QTP automation matchups that are thrown your way.

The Layout of the QTP Descriptive Programming Unplugged Book

QTP — Descriptive Programming Unplugged covers more advanced topics in Quick Test Professional that you'll inevitably need to know once you've got the basics under your belt. The book is 454 pages long, and is broken up in 18 chapters with appendixes. The chapters are:

  • Introduction to Object
  • Object Repository
  • Descriptive Programming
  • Visual Identifiers
  • ChildObjects
  • HTML DOM
  • Visual Relation Identifiers using HTML DOM
  • WebTables
  • Testing Complex HTML Tabls
  • Localization Techniques and Design Patterns
  • Object Identification using XPath
  • Object Identification using CSS
  • ObjectRepositoryUTIL
  • Working with QTP XML OR
  • Testing Web Services
  • Coding Scripts in .NET
  • Web Extensibility
  • Creating Reserved Objects
  • Appendix A – Approaches for Issue Resolution
  • Appendix B – Performance Benchmarks
  • Appendix C – XPath vs CSS
  • Appendix D – Nesting or RegisterUserFunc Methods
  • Appendix E – Eval and Execute
  • Appendix F – Cross-Browser Tests

I like how this book builds up steam; the chapters get progressively more advanced the further into it you get. The first chapter provides a nice introduction to QTP object identification for anyone who has ever wondered how QTP recognizes objects in an application. It even contains a cool object identification algorithm diagram that shows the steps QTP goes through to try to ID an object.

It's important to know these steps, because if you're having issue with QTP not recognizing your application, having that basic knowledge will allow you to better diagnose issues, as well as come up with some viable workarounds.

The next chapters walk you through the ins and outs of the object repository (OR), and go into detail (with examples) on how you can use descriptive programming to interact with application fields without using the OR. The descriptive programming section also explains why and when it should be used.

QTP Descriptive Programming Unplugged Not just for QTP engineers

Other topics covered that every automation engineer should know, regardless of which test tool(s) they're using, include how to use the HTML DOM, XPath and CSS.

Some of the topics that are covered near the end of the book are ones that I rarely see in any QTP books or manuals anymore — for instance, how to test and handle multiple languages testing (also known as Localization).

My favorite chapter has to be Coding Scripts in .NET. By reading it you will learn some cools ways you can utilize .NET and C# (rather than VBScript) to code your script using a COM based bridge. How awesome is that!?

Buy this QTP Descriptive Programming Unplugged Book!

If you could only have two books on QTP both of them should be by Tarun :QTP Unplugged, and now QTP–Descriptive Programming Unplugged – Master Object Identification Techniques.

Both are must-haves for the serious QTP engineer, so be sure to pick them up. Hint: with Christmas right around the corner, QTP–Descriptive Programming Unplugged would make a great gift for your favorite automation geek.

Bonus – Increase your Karma

As an added bonus, not only will buying this book increase your knowledge but it will also increase your Karma. A portion of each copy of sold, a portion of the proceeds will be donated to organizations working towards the cause of child education. True automation goodness. In fact, it make me want to say Randy “Macho Man” Savage’s signature catch phrase, “Ooh yeah!”

Note: I did receive a free copy of this book to review from Tarun.

 

7 responses to “QTP Descriptive Programming Unplugged Book Review”

  1. Hi,

    Is it possible to add objects to a object repository automatically(using vb scripts) ? . Lets say I have list of links in my webpage/application.It would be time consuming,when I add objects manually so I tried to add objects to repository automatically.But couldn’t able to proceed as I don’t know how to activate object repository window in qtp. Below is my code which I tried
    Function Objects_Count(myObject)
    Dim Objects
    Set Objects=Description.Create
    Objects(“micclass”).value=myObject
    set obj=Browser(“title:=.*”).Page(“title:=.*”).ChildObjects(Objects)
    For i=0 to obj.count-1
    ‘ msgbox i
    c=obj(i).getroproperty(“name”)
    If obj(i).Exist(1) Then
    obj(i).highlight
    End If
    Print c
    Next
    End Function
    Call Objects_Count(“link”)

    The above code will get the links name displayed in a log file and also it will highlight in application/webpage. Please guide me ,how to add the properties of that links(objects) to object repository.

    Thanks! visitjaga@gmail.com

  2. Jagdeesh,

    I noticed your question on Joe Colantonio’s blog and thought I would share the following information with you. The last I heard QTP does not support this at run time, but I believe it is possible to create them from scratch although I can’t seem to find my code for it right now. I’ve found it works very well to only learn your Browser and Page objects and then use Descriptive Programming to handle the child objects on the fly. The following is an example of how to use a function and pass it information to create an object dynamically at run time:

    Option Explicit

    Public Function CreateDynamicObject(ByRef obj_Dynamic, ByVal arr_Properties)
    ‘Please note that this does not perform any error handling so if you do not send in
    ‘the appropriate object and string value it will simply throw an error.
    Dim arr_Property
    Dim str_Properties
    Dim str_Attribute
    Dim str_Value

    Set obj_Dynamic = Description.Create()
    For Each str_Properties In arr_Properties
    arr_Property = Split(str_Properties, “:”)
    str_Attribute = arr_Property(0)
    str_Value = arr_Property(1)
    obj_Dynamic(str_Attribute).Value = str_Value
    Next ‘str_Properties
    End Function

    Sub YourAction()
    Dim obj_Page
    Dim obj_Description

    Set obj_Page = Browser(“title:=.*”).Page(“title:=.*”)
    Call CreateDynamicObject(obj_Description, “html tag:INPUT;type:radio;name:rdoRadio”)
    obj_Page.WebRadioGroup(obj_Description).Select “On”

    Set obj_Page = Browser(“title:=.*”).Page(“title:=.*”)
    Call CreateDynamicObject(obj_Description, “html tag:INPUT;type:text;name:txtNameFirst”)
    obj_Page.WebEdit(obj_Description).Set “Christopher”

    Set obj_Page = Browser(“title:=.*”).Page(“title:=.*”)
    Call CreateDynamicObject(obj_Description, “html tag:INPUT;type:text;name:txtNameMiddleI”)
    obj_Page.WebEdit(obj_Description).Set “J”

    Set obj_Page = Browser(“title:=.*”).Page(“title:=.*”)
    Call CreateDynamicObject(obj_Description, “html tag:INPUT;type:text;name:txtNameLast”)
    obj_Page.WebEdit(obj_Description).Set “Scharer”

    Set obj_Description = Nothing
    End Sub

    PS I’ll send the code that will add objects to the repository when if I can find it, but I would suggest doing something like this so if there is any change you can simply update your code and not worry about making a change in your code and your OR.

    Sincerely,
    Christopher J. Schärer
    Director (Vice President), Iowa, Nebraska & TQA-SIG Chapter Leader
    Vivit Worldwide
    http://www.vivit-worldwide.org

  3. Description
    Adds the specified object to the object repository under the specified parent object.
    Important Information
    You can use this method to add a copy of an object that you retrieved from a different object repository.

    Tip: Before adding an object to the object repository, you can modify its description properties using the SetTOProperty method. For more information about this method, see the QuickTest Professional Object Model Reference.

    Syntax
    object.AddObject (Object, Parent, [Name])

    Syntax Details
    Argument Description
    object An expression evaluating to an object of type ObjectRepositoryUtil.
    Object Required. An Object object.
    The object to add to the object repository.

    Tip: You can use the GetObject, GetObjectByParent or Item methods to retrieve the test object to use as this argument value.

    Parent Required. A Variant value.
    The parent object.

    You can specify the parent test object’s IDispatch pointer or its full path as it appears in the Expert View, for example, Browser(“Welcome: Mercury Tours”).Page(“Welcome: Mercury Tours”).

    If you want to add the object as a top-level test object, or you are adding a checkpoint or output value object, specify NULL as the Parent argument value.

    Name Optional. A Variant value. The name to use for the object in the object repository. If you do not specify a name, one of the object’s property values is used as its name (The property used depends on the object class. In most cases, the “name” or “value” property is used).

    Return Type
    A Variant value. The name of the object as saved in the object repository.

  4. Hi Joe,
    how do i get parent object logical name by supplying the child object logical name from OR?
    Ex:Browser().page().WebEdit(“SignIn”)
    Here, if i supply the webEdit logical name “SignIn” it should return browser logical name
    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Robot Book Reading