GetTOProperty、GetROProperty、GetTOProperties的区别(转帖)

上一篇 / 下一篇  2010-09-15 19:13:48 / 个人分类:自动化测试技巧

使用GetTOProperty获取控件属性

GetTOProperty用于赶回测试对象的当前属性,例如下面的测试脚本用于获取Login窗口的标题属性:

Dim LoginTitle

LoginTitle=Dialog("login").GetTOProperty("text")

Msgbox LoginTitle

 

GetTOPropertyGetROProperty都用于取出对象的某个具体属性的值,它们的语法和用法几近相同,唯一的区别就是GetTOProperty取出的是录制对象的属性值,而GetROProperty取出的是在回放过程中运行的对象的属性值.

GetTOProperties,是指取出录制对象的所有属性。

GetTOProperty和GetROProperty语法都是:

object.GetTOProperty(Property)

或者是:

object.GetROProperty(Property)

其中Property,对象的属性,是必填项.

GetTOProperties的语法为:
object.GetTOProperties

实例:

Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "training"
Dialog("Login").WinEdit("Agent Name:").Type  micTab
Dialog("Login").WinEdit("Password:").SetSecure "429376f06698f739df8bb1c09eab3d78dee316f7"
Set TableDesc = Dialog("Login").WinEdit("Password:").GetTOProperties
Properties=TableDesc.Count
reporter.ReportEvent micdone,"属性数目",Properties
If Dialog("Login").WinEdit("Password:").GetROProperty("attached text")="Password:" then
 reporter.ReportEvent micdone,"name控件","存在"
 else
 reporter.ReportEvent micdone,"name控件","不存在"
end if
 If Dialog("Login").WinEdit("Password:").GetTOProperty("attached text")="Password:" then
 reporter.ReportEvent micdone,"name控件2","存在"
end  if
Dialog("Login").WinButton("OK").Click
'did the flight reservation window appear?
Window("Flight Reservation").Check CheckPoint("Flight Reservation")
Set Mydes=Descrīption.Create()
Mydes("attached text").value="Name:"
Mydes("nativeclass").value="Edit"

Set winedites=Window("Flight Reservation").ChildObjects(Mydes)
NoOfChildObjs =winedites.Count
For Counter=0 to NoOfChildObjs-1
 if(Counter=0) then
       winedites(Counter).Set "ON"
  end if
Next


TAG:

qiqin的个人空间 引用 删除 qiqin   /   2010-09-15 19:21:48
相关的几个函数有:

GetTOProperty():取得仓库对象的某个属性的值
GetTOProperties():取得仓库对象的所有属性的值
SetTOProperty():设置仓库对象的某个属性的值

GetROProperty():取得实际对象的某个属性的值
qiqin的个人空间 引用 删除 qiqin   /   2010-09-15 19:19:57
关键在于RO和TO,R,就是Runtime,T就是Testtime,O就是Object。因此顾名思义,RO就是在测试执行时的对象,TO就是录制/编写测试时的对象。是同一个类在不同的时间生成的不同的实例,一般来说TO是静态的,而RO是动态的(每次执行测试都会生成新的实例)。
 

评分:0

我来说两句

日历

« 2024-05-03  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 11611
  • 日志数: 13
  • 建立时间: 2010-09-15
  • 更新时间: 2010-10-20

RSS订阅

Open Toolbar