QTP

What is the difference between RO-Properties and TO-Properties in QTP?

老子叫甜甜 提交于 2019-12-10 12:10:37
问题 In QTP each test object supports the following methods GetRoProperty GetToProperty SetToProperty GetToProperties What is the difference between a RO -property and a TO -property and why can I only set a TO -property and not an RO -property? 回答1: The difference between RO -Properties and TO -Properties are that TO properties refer to the properties as they exist in the Test Object saved in the test (i.e. in the object repository or as described in descriptive programming) and the RO

Set Object Reference in UFT with or without the “Execute” Statement

核能气质少年 提交于 2019-12-10 11:44:01
问题 Recently I have been assigned a project wherein the object references are set using the "Execute" Statements as shown below: Execute "Set objButton = XamRibbonWindowAddin(""XamWindow_DashBoard"").WpfButton(""Save"")" Whereas, my approach for setting the object references has always been like this(without the "Execute" Statement): Set objButton = XamRibbonWindowAddin("XamWindow_DashBoard").WpfButton("Save") I have been using the latter method as it allows me to make use of Intellisense in UFT

Need to pass object and operation in a function that executes it

爷,独闯天下 提交于 2019-12-10 11:38:22
问题 I need to pass an object and its operation in a function so that each time I can call the function only and save me to write same steps for all the objects like validating the object before performing an operation. Similar way to a Register User Function in QTP/UFT. However, Testcomplete doesn't have this feature (atleast under my knowledge, would be happy to know if there is) This is my code that I am trying but unable to: Call OpenPageorTab("Aliases.Admin.wndMain.toolStrip", ".Visible")

UFT入门教程(10)—步骤生成器、描述性编程

假如想象 提交于 2019-12-10 05:36:06
##步骤生成器 ###作用 录制web测试脚本中,存在一些步骤无法被录制,此时需要步骤生成器来生成脚本步骤。 ###步骤 1.点击“设计-步骤生成器”(快捷键F7)打开“步骤生成器” 2.选择对象-设置对对象的操作 ##描述性编程 ###原理 QTP(UFT)对象的鉴别原理:在QTP(UFT)回放时,通过脚本中对应对象库中的对象的属性与真实测试对象的属性进行对比并且能够唯一匹配之后才能够对对象进行操作。 而描述性编程其实就是通过把对象库中的对象属性的描述全部通过脚本体现出来,并且可以脱离对象库进行运行脚本。 ###步骤 1.通过对象侦测器捕捉并查看对象属性(可唯一标识对象的属性) 2.选择对象标识属性,进行脚本编写 Browser("name:=百度一下,你就知道").Page("title:=百度一下,你就知道").WebEdit("name:=wd").Set"qtp" Browser("name:=百度一下,你就知道").Page("title:=百度一下,你就知道").WebButton("name:=百度一下").Click Browser("name:=qtp_百度搜索").Page("title:=qtp_百度搜索").WebEdit("name:=wd").Click Browser("name:=qtp_百度搜索").Page("title:=qtp_百度搜索")

UFT入门教程(1)—安装与录制脚本

佐手、 提交于 2019-12-09 17:54:14
一、下载安装 下载地址自行搜索,官网下载需注册用户,试用期30天。 安装时需要注意的是插件的选择安装,本人选择全部安装,以备不时之需。 二、连接ALM 连接ALM “连接ALM”可将UFT的自动化测试保存到ALM项目的“测试计划”中,以便添加测试到ALM中。 文件另存为至ALM目录(由于无法连接至ALM服务器,所以只显示本地文件系统) 设置使ALM可以调用UFT 步骤:点击菜单栏“工具”-“选项”-弹出对话框选择“GUI测试”(本例相关),勾选“允许其他HP产品运行测试组件” 结果:在ALM的“测试集”的自动测试时可以调用UFT实现自动化测试 三、录制运行脚本 点击“录制”按钮。首次运行将弹出对话框,以添加被测程序路径 (ps:修改路径可选择菜单栏中“录制”选项的相关设置进行修改) 入门学习选择惠普的自带GUI软件,点击确认 手动测试,录制脚本。录制结束点击“结束”按钮 运行脚本并查看结果 来源: oschina 链接: https://my.oschina.net/u/2866387/blog/746475

UFT开发实例:DataTable操作实例

对着背影说爱祢 提交于 2019-12-09 17:47:02
DataTable的操作包括: DataTable.GetSheet(dtSheet) DataTable.GetSheetCount DataTable.[GetSheet.]GetRowCount DataTable.[GetSheet.]GetParameterCount DataTable.GetSheet(sSheetName).GetParameter(“ColumName”).ValueByName(iRowNumber) DataTable.[GetSheet.]GetCurrentRow DataTable.[GetSheet.]SetCurrentRow(RowNumber) DataTable.Value(ParameterID [, SheetID]) or DataTable (ParameterID [, SheetID]) DataTable.AddSheet(SheetName) DataTable.DeleteSheet(SheetName) DataTable.Export(filename) DataTable.ExportSheet(filename,SheetName) DataTable.Import(FileName) DataTable.ImportSheet(FileName, SheetSource, SheetDest) 1

UFT自动化测试工具实例代码

為{幸葍}努か 提交于 2019-12-09 15:46:15
压缩包地址: https://yunpan.cn/cBVSfeEheVAcv (提取码:5d87) 压缩包中包含以下实例,代码都是可直接运行的,导入UFT中即可: 1、Action传参实例 2、参数化实例 3、Descriptive Programming实例 4、Excel表单元格颜色控制 5、QTP读取Excel数据保存到数组的实例 6、QTP读取Txt内容作为参数化数据实例 7、QTP计算操作的时间 8、QTP调用OutLook自动发送邮件 9、SetToProperty用法实例 10、导出测试结果到Excel表 11、顶级Action参数用法 12、订票过程实例 13、读取指定单元格的数据并保存到另一表的指定位置 14、读Oracle数据实例 15、计算器实例 16、将指定的Excel表的数据写入到另一张表 17、一个流程验证的实例代码 18、系统信息录入过程代码 19、描述性编程参数化 20、完整上报Bug流程 21、循环数据使用案例 22、在Excel中搜索指定的值 23、自动读取数据库中的数据并调用OutLook发送 24、自动获取内存信息 来源: oschina 链接: https://my.oschina.net/u/2391658/blog/704816

UFT代码片段整理(1)

爷,独闯天下 提交于 2019-12-09 15:46:06
1.手工参数化 Browser("百度一下,你就知道").Page("百度一下,你就知道").WebEdit("wd").Set DataTable("searchContent",dtGlobalSheet) For i=1 to Datatable.GetRowCount Dialog("Login").WinEdit("Agent Name:").Set DataTable("username", dtGlobalSheet) Dialog("Login").WinEdit("Password:").Set DataTable("passwd", dtGlobalSheet) Dialog("Login").WinButton("OK").Click datatable.GlobalSheet.SetNextRow Next MsgBox "提示信息:"&vbCrLf&"操作成功",vbInformation,"Title" 2.在介绍对象库前首先要说一下QTP自动化的原理 (1).封装被测对象到对象库 (2).对比对象库里的对象属性和运行时的真实被测对象的属性 (3).对比一致后找到相应的对象 3.手动添加对象 Resources-->Object Repository-->Object -->Add Objects to Local 4.创建保留对象的会话实例

UFT开发实例:一个完整的测试框架源码

独自空忆成欢 提交于 2019-12-09 15:43:55
自己2011年做保险系统中理赔流程自动化时,开发的一个小框架。当时还没有selenium,不过基于UFT的一些功能还是比较实用的,可用于参考。 框架源码: https://yunpan.cn/cBVBxA6x2iXHD (提取码:2165) 一、已实现的功能列表 框架已经实现的功能如下: 1、脚本数据分离 2、异常截图并关联截图 3、无界面启动UFT 4、定时启动UFT 5、步骤日志跟踪 6、数据库检查点验证 7、测试结果发送 8、测试报告生成 9、场景恢复 10、脚本执行速度控制 11、系统资源监控,如Cpu峰值监控(基于UFT) 12、执行过程录制回放(基于UFT) 二、框架部分关键代码 1、必须导入的驱动脚本,用户全局环境控制 Call driver() Function driver() '初始化环境,包括获得project所在的本地目录。 projectPath = getProjectPath() sourceDataFile = projectPath&"\TEST.xls" sourceDataSheet = "Sheet1" Dim qtApp 'As QuickTest.Application ' Declare the Application object variable Dim qtTest 'As QuickTest.Test ' Declare a

UFT开发实例:常用的代码片段

风格不统一 提交于 2019-12-09 15:27:59
1 生产随机数列 第一种方法 CODE: randomize'更新反回的数据 funcation rand(k,n) n=int((k-1)*rnd+1) rand=n end funcation 第二种方法 CODE: n=randomnumber.value(1,255) 2 当运行到表中的某一行,自动导出表中的所有数据 CODE: row=datatable.getcurrentrow if row="5" then datatable.export("d:\data.xml") end if 3 自动识别未加密的密码 CODE: webedit("txtpass").setsecure"sdsdf...." 如果参数化密码,可以直接在数据表中写入未加密的密码,它会自动识别,即不用把setsecure改为set 4 如果弹出对话框就获取上面提示信息并与表中的信息对比,不统一证明弹出的提示出错,主要用来验证 CODE:  if browser("web_name").dialog("dialog_name").exist(1) then'如果不出现=false error_message=browser("web_name").dialog("diaglog_name").static("用户密码错误!".getRoproperty("text")    if error