what is the use of Object(poroperty) in qtp
what is the use of Object(poroperty) for example
开发者_开发知识库JavaWindow(something).JavaStaticText("class_index="&i) ''# i is the increment variable.
what are the uses using like this instead of
JavaWindow("Form").JavaStaticText("Name")
This is known as Descriptive Programming or Programmatic Description it's when the object's description is inline in the script rather than in the Object Repository (OR).
You have the syntax slightly wrong though it should be colon equals (:=
) and not just equals(=
).
Usual test objects in QTP are stored in the OR so when you say JavaWindow("something")
QTP looks in the OR to find an object of type JavaWindow
named "something"
and checks what the description is (for example text == "OK"
). In DP you specify the description inline in the script.
DP is useful when the description of an object is dependant on the test flow.
One thing to note is that in DP all property values are treated as regular expressions (this can be changed if you use a Description
object).
Here's a blog post with more information.
精彩评论