QTP自定义函数批量注册 - RegisterUserFuncX
来源:互联网 发布:ftp网闸端口 编辑:程序博客网 时间:2024/06/10 17:30
我们在编写QTP的自定义函数时通常用RegisterUserFunc来注册到指定的测试对象,但是如果碰到需要注册到很多测试对象的情况,则需要一条条注册,比较麻烦。Anshoo Arora给我们介绍了一个批量注册的方法:
http://relevantcodes.com/registeruserfuncx-register-methods-to-all-qtp-objects-automatically/
这种方法的关键之处在于利用了QTP在注册表中的信息:
Function RegisterUserFuncX(TOMethodName, FunctionName)
Dim oRegistry, arrSubKeys, sSubKey, sKeyPath
Const HKEY_LOCAL_MACHINE = &H80000002
sKeyPath = "SOFTWARE/MERCURY INTERACTIVE/QuickTest Professional/MicTest/Test Objects"
Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!//." &_
"/root/default:StdRegProv")
oRegistry.EnumKey HKEY_LOCAL_MACHINE, sKeyPath, arrSubKeys
For Each sSubKey In arrSubKeys
RegisterUserFunc sSubKey, TOMethodName, FunctionName
Next
Set oRegistry = Nothing
End Function
取出所有注册的测试对象后调用RegisterUserFunc函数逐一进行自定义函数的注册。也可以针对某一类测试对象(例如Web对象)进行注册:
'Register all the Web Objects
For Each sSubKey In arrSubKeys
If InStr(1, sSubKey, "Web") > 0 Then
RegisterUserFunc sSubKey, TOMethodName, FunctionName
End If
Next
- QTP自定义函数批量注册 - RegisterUserFuncX
- QTP自定义函数知识点
- qtp添加自定义函数
- hibernate 注册自定义函数
- SparkSQL注册自定义函数
- 批量注册函数名方法机制
- QTP函数
- QTP函数
- 注册自定义的异常处理函数
- C# 注册并使用sqlite 自定义函数
- C# 注册并使用sqlite 自定义函数
- 自定义QTP执行日志
- 自定义QTP执行日志
- 自定义UDTF和hive自定义函数的永久注册
- QTP专用函数
- QTP常用VBS函数
- QTP常用函数
- QTP常用函数
- CYPRESS FX2读书笔记
- wind river
- 解决了DNW下不能进系统的问题
- 【编程游戏】贺岁霓虹灯。(参观261楼dh20156的霓虹灯)
- ubuntu下xampp的安装
- QTP自定义函数批量注册 - RegisterUserFuncX
- 唉,房奴!买套房到底要奋斗多少年
- APC(Alternative PHP Cache)
- tomcat配置,使用http://localhost:8080/来访问工程
- PHP常用字符串函数收集(60个)
- 创建模式之一:抽象工厂(Abstract Factory)续2
- 搞笑日记
- 归并排序算法
- virtual function