RepositoriesCollection对象可以来管理测试运行时的共享对象库,动态的加载共享对象库,加载的对象库仅在测试过程中有效,类似于在associate repositories中的操作
W,\ [Ew Tj5o051Testing软件测试网Cu^1iF@A|1.属性:
Count :返回运行时共享对象库文件的个数
Item:返回指定index位置在对象库中的对象库文件的路径
2.方法:
add :添加对象库文件到运行时共享对象库
find:返回指定路径在对象库中的位置索引,若不存在返回-1
moveToPos:移动指定位置索引到新的位置
remove:移除指定位置的对象库文件
removeall:移除所有运行时对象库文件
3.使用:
RepPath = "d:\12.tsr"
RepPath2 = "d:\123.tsr"
RepositoriesCollection.RemoveAll() '移除所有
RepositoriesCollection.Add(RepPath) '添加到起始位置,默认1
RepositoriesCollection.Add RepPath2,2 '添加reppath2到索引2位置,注意添加第一个共享库文件时,位置只能为1
RepositoriesCollection.MoveToPos 1,2 '将RepPath从位置1移动到位置2
Pos = RepositoriesCollection.Find(RepPath) '返回2
MyObjRepFiles = RepositoriesCollection.Count '返回2
RepositoriesCollection.Item(1) '返回d:\123.tsr
Pos = RepositoriesCollection.Find(RepPath)
RepositoriesCollection.Remove(Pos) '移除repPath
Pos = RepositoriesCollection.Find(RepPath) '返回为-1
51Testing软件测试网R#FvA3F@ B Count :返回运行时共享对象库文件的个数51Testing软件测试网-eZ2~/~7|J7G Item:返回指定index位置在对象库中的对象库文件的路径51Testing软件测试网T&I@b0_Sq.d/a 2.方法: Q;gFFB5j0add :添加对象库文件到运行时共享对象库51Testing软件测试网2qA3n-tp0o J9] find:返回指定路径在对象库中的位置索引,若不存在返回-1 JoR@t!B(B d&u0E0moveToPos:移动指定位置索引到新的位置51Testing软件测试网\1o-S7gj8zRT!k remove:移除指定位置的对象库文件51Testing软件测试网P T'z4~8y~ removeall:移除所有运行时对象库文件51Testing软件测试网R#FvA3F@ B
Count :返回运行时共享对象库文件的个数51Testing软件测试网-eZ2~/~7|J7G
Item:返回指定index位置在对象库中的对象库文件的路径51Testing软件测试网T&I@b0_Sq.d/a
2.方法:
Q;gFFB5j0add :添加对象库文件到运行时共享对象库51Testing软件测试网2qA3n-tp0o J9]
find:返回指定路径在对象库中的位置索引,若不存在返回-1
JoR@t!B(B d&u0E0moveToPos:移动指定位置索引到新的位置51Testing软件测试网\1o-S7gj8zRT!k
remove:移除指定位置的对象库文件51Testing软件测试网P T'z4~8y~
removeall:移除所有运行时对象4.实例
'实例:根据对象库共享的方法,对UFT自带小程序 flight 的登录脚本进行修改
systemutil.Run"C:\Program Files (x86)\HP\Unified Functional Testing\samples\flight\app\flight4a.exe"
'使用repositoriescollection方法从本地添加公共的对象库
repositoriescollection.Add("E:\qtp jaioben\repositoriescollection.tsr")
Dialog("Login").WinEdit("Agent Name:").Set "join"
Dialog("Login").WinEdit("Password:").SetSecure "577b2e0c4b9a8c0e1e492d7322ef11d098748ffc"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close