Login   /   Register

Change QTP’s Automatic Object-Naming Convention

Rate this article
     3 votes, average: 5 out of 53 votes, average: 5 out of 53 votes, average: 5 out of 53 votes, average: 5 out of 53 votes, average: 5 out of 5
Loading ... Loading ...
November 17th, 2008 by Yaron Assa

Have you ever got frustrated with the arbitrary names QTP gives to test-objects?

When you want it to take the name from the “HTML ID”, it takes it from the the object’s “CLASS”; when you want it to take the “PROG ID”, it takes it from the “NATIVECLASS”; and in general, it seems that QTP has a very poor logic when it comes to choosing Test-Object names.

Actually, QTP has a very good logic, it’s just that it works based on the assumption that, on the average, the resulting names would reflect the meaning the developer wished to convey with the values of these properties. However, because of this same reason QTP is bound to fail in some applications. Luckily, we can override it and hence force QTP to name objects according to the properties we choose.

In order to change the way objects are named, make sure QTP is closed, open the registry editor, and navigate to the following entry:

HKCU\Software\Mercury Interactive\Quicktest Professional\MicTest\Test Objects\ (HKCU means HKEY_CURRENT_USER)

Under that registry node, you’ll find keys for each and every test-object class in QTP. Expand the one you wish to change (For example: Browser).

You will notice that the key has a string value property called “tag query name” – change it to a name of a property (for example – title). The current value (“logical name”) doesn’t correspond to a specific property, but is probably an algorithm for trying several properties until hitting a meaningful value.

After that, open QTP, and record an object from the class you have just changed. You will see that its name is derived from the property you have specified.

And there you have it. I hope this will help you to work more smoothly with QTP, and save you the often tedious task of editing the object identification properties for better readability and maintainability.

Posted in General, QTP

13 Responses to “Change QTP’s Automatic Object-Naming Convention”

  1. michael.entwistle Says:

    [+]

    Thanks, Yaron. Excellent tip. A colleague and I were wondering about the algorithm used for naming objects but it didn't occur to ... ...

  2. deependra Says:

    [-]

    Nice tip…it will help to customize object naming if its not conisent through out applcation……

  3. aviationfan Says:

    [-]

    This is something that has annoyed me for a long time and now I can fix it! Thanks for the tip.

  4. heqingbluesky Says:

    [-]

    Great tip to tackle annoying naming mechanism of QTP.

  5. Kumar.vastav Says:

    [-]

    A very nice tip. Thanks Yaron.

  6. raaz4all Says:

    [-]

    Mindblowing trick..Thanks a lot.

  7. m_sud Says:

    [-]

    brilliant trick to get useful names in OR.

  8. krishnbharathi Says:

    [-]

    what is registry editor, i could not find it out,

    can u help in this

  9. Yaron Assa Says:

    [+]

    You can find it under Start->Run and type Regedit However, if you're unfamiliar with the tool, it might be best to leave these t... ...

  10. Rao Says:

    [+]

    this is an excellent trick.... It really worked in local system. But what happens if i run the same script in another machine w... ...

  11. Adarsh Says:

    [-]

    Superb trick Assa

  12. raghuramsai Says:

    [-]

    Thanks Yaron. It is very helpful and reduce the time to work on naming conventions. Thanks a lot for giving superb trick.

  13. bklabel Says:

    [-]

    Have others used this trick? How is it working for you. Are there other articles on this topic?

Leave a Reply

You must be logged in to post a comment.

This article was viewed 1114 times