Search code examples
qtphp-uft

Why does Page.GetTOProperty ("index") return absurdely high values while empty would be the correct value?


I am observing a strange thing with the Page.GetTOProperty method. Steps to reproduce:

  • Create a new scripted business process testing (BPT) component (use an “empty” application area without any libraries or shared object repositories)
  • Open one IE browser instance and navigate to google.com (or any other website, it does not matter)
  • Use object spy to add the page testobject to the action-based object repository ("OR"). When offered, don't add any "descendant" (should be "child") objects (except for the browser which is added automatically if you add the page)
  • Close the browser instance (or don't, this does not seem to matter)
  • Paste this script code:

    Dim IndexPropVal IndexPropVal=Browser("Google").Page("Google").GetTOProperty ("index") Print "IndexPropVal=" & CSTr (IndexPropVal) & " IsEmpty=" & CStr (IsEmpty (IndexPropVal))

  • Run the script

Questions:

  • Why does it output the following?

    IndexPropVal=20002 IsEmpty=False

In some cases it is 10002, in other cases 20002 or 30002, for which the reason is unknown.

  • Why doesn't it print this:

    IndexPropVal= IsEmpty=true

which is what I would expect, as for all TO properties that are not defined in the OR, GetTOProperty should return empty?

The variations (10002 versus 20002 versus 30002) might depend upon whether the test object is in an object-based OR or not, and/or whether the script is a component or a GUI action script in some way, but this doesn't always seem to be the case.

It surely is independent of how often you run the script, or if you close UFT between runs.

It also does not matter if you turn on or off smart identification globally, or for each individual OR entry (i.e. the browser OR entry, and the page OR entry).

I cannot find any reproduceable dependency!

I observed that first in UFT 14.50.

I am sure that UFT 12.03 correctly used to report the Empty value if no index property was defined in the object repository.

What is going on?


Solution

  • Since there is always only one Page object per Browser object the index is meaningless, if the description is empty or fits there is one match and if the description doesn't match there are no matches. As index is an ordinal selector, only used if multiple objects match a description, it is useless for Page test objects.

    UFT seems to be using the index property for internal housekeeping, you shouldn't be using it and it shouldn't effect your tests.