DP Part 3 – Dummy properties

上一篇 / 下一篇  2011-09-17 12:40:32 / 个人分类:QTP

In our Last DP Part 1 article we saw how to convert an OR based script. into a DP based script. But what we didn’t discuss was the micclass property we used for the Browser. This article will go over various aspects of properties and introduce some terms that I use for DP

micclass

micclass represent the type of QTP test object. Let’s take a look at below code

'Displays page
MsgBox Browser("Browser").GetTOProperty("micclass")
 
'Displays Page
MsgBox Browser("Browser").Page("Google").GetTOProperty("micclass")

To generalize we can say micclass of a QTP Test object is always the object keyword name we use. So WebXXX(“YYY”) will have micclass as WebXXX

Dummy Properties

When in DP Part 1 article we converted the Browser statement we use

Browser("micclass:=Browser").Navigate "http://www.knowledgeinbox.com"

Now I call this micclass:=Browser a dummy property because as soon as I say Browser(“XXX”) it already implies that the micclass of the object is Browser. So why did we use micclass? Reason being that the Browser object in the object Repository didn’t had properties define as we had only one browser opened at time of replay. So to represent a unique/single instance object in DP we cannot use something like below
'Below is an invalid statement
Browser("").Navigate "http://www.knowledgeinbox.com"
 
'Below is an invalid statement
Browser().Navigate "http://www.knowledgeinbox.com"
 
We need to specify atleast one property in case of DP. So we use a dummy property micclass as the convention
Browser("micclass:=Browser").Navigate "http://www.knowledgeinbox.com"
 

TAG:

 

评分:0

我来说两句

Open Toolbar