016专家视图测试脚本开发_utility对象
2014-10-28 16:13
323 查看
utility对象
(1)这个例子是:Extendtest
使用Extend对象加载DLL,我们可以使用它来丰富windows api函数,能够编写更为强大和灵活的测试代码
实例代码:
'声明FindWindow方法,调用user32.dll中的FindWindowA函数Extern.Declare.micHwnd,"FindWindow","user32.dll","FindWindowA",micString,micString
'声明SetWindowText方法
Extern.Declare miclog,"SetWindowText","user32.dll","SetWindowTextA",micHwnd,micString
'获取记事本的窗口的句柄
hwnd = Extern.FindWindow("Notepad",vbNullString)
If hwnd = 0 Then
MsgBox"未能找到记事本窗口"
End If
'改变记事本窗口的标题
res = Extern.SetWindowText(hwnd,"Hello world")
结果:当记事本打开的时候记事本的标题是”Hello world“,但是有如下的问题:
(2)SystemUtil对象:调出计算器程序
如:
'控制应用程序和进程
Systemutil.Run"calc"
(3)reporter对象:可用于发送信息到测试结果文件,这对于测试结果分析比较有用。可以使用Reporter对象的ReportEvent方法来向测试结果写入一个事件
如:
Reporter.ReportEvent micDone,"开始学习QTP","学习QTP很快乐"
Reporter.ReportEvent micFail,"开始学习QTP","学习QTP很痛苦"
二、参数化中:变量放入data table和随机数。Window("Flight Reservation").ActiveX("MaskEdBox").Type "121214"
Window("Flight Reservation").WinComboBox("Fly From:").Select DataTable("from_Item", dtGlobalSheet)
Window("Flight Reservation").WinComboBox("Fly To:").Select DataTable("to_Item", dtGlobalSheet)
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select RandomNumber(0, 100)
Window("Flight Reservation").WinEdit("Name:").Set "tom"
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").Move 414,180
但选择随机数的时候提示下面的错误:
相关文章推荐
- 016专家视图测试脚本开发- Environment对象的使用;Msgbox和Print的区别
- 开发自动化测试脚本的技巧和心得
- 开发自动化测试脚本的技巧和心得
- ebs add on 开发测试脚本
- 导出所有对象(表、索引、视图、同义词)的创建脚本
- oracle导出创建用户下各个对象数据结构的sql语句的脚本,包括表、视图、索引、约束等等
- (翻译)开发自动化测试脚本的技巧和心得
- 在RFT中如何通过脚本获取已添加到某个脚本中的测试对象?
- ebs add on 开发测试脚本
- ebs add on 开发测试脚本
- “测试实践丛书”系列之“LoadRunner Vuser脚本开发”
- (翻译)开发自动化测试脚本的技巧和心得
- 复习:C#3.0面向对象测试开发包
- 使用VBScript开发自动化测试脚本4
- ebs add on 开发测试脚本
- 开发自动化测试脚本的技巧和心得
- 使用VBScript开发自动化测试脚本3
- 在开发环境中常遇到更改存储过程、函数、视图等对象,解决SQL Server2005里sp_helptext输出格式错行问题
- ebs add on 开发测试脚本
- Java面向对象和数据库的脚本开发项目的不同