【转】QTP10动态加载共享对象库文件
上一篇 /
下一篇 2012-03-19 09:21:01
/ 个人分类:QTP
【转】QTP10动态加载共享对象库文件
RepositoriesCollection对象可以来管理测试运行时的共享对象库,动态的加载共享对象库,加载的对象库仅在测试过程中有效,类似于在associate repositories中的操作
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
转载原文出自:http://www.cio360.net/h/1812/374386-11264.html
收藏
举报
TAG: