29 What’s New in QTP

29.1 IDE Enhancement:

Comment Block: Comment by “CTRL+M”, uncomment by “CTRL+SHIFT+M”.

Local Function List: Display only local function by “ALT+.”

Ignore Browser: Ignore QC and other pages, setting in “ToolsàOptionsàWeb”

29.2 Added and Enhanced Utility Objects:

QTP adds two methods to the SystemUtil object: BlockInput  & UnBlockInput Method:

BlockInput : Prevents keyboard and mouse input events fromreaching applications. Input is block until UnBlockInput method called or “CTRL+SHIRT+DEL”key pressed.

29.3 The Print Log Utility

a.     Show/Hide the “print log window”

'API declaration for ShowWindow API

Extern.Declare micLong,"ShowWindow","user32","ShowWindow",micLong,micLong

'ShowWindow constants

Const SW_HIDE = 0

Const SW_SHOW = 5

'Function to hide the print log window

Public Function HidePrintWindow()

‘Set visible value: see if print log window is already visible or not

Set QTPlogWindow = Window("regexpwndclass:=Mercury::Qtprn::PrintWindow" ,"visible:=True|False")

'Check if the LOg window exist

If QTPlogWindow.Exist(0) Then

hwnd = QTPlogWindow.GetROProperty("hwnd")

'Show/Hide the window, choose the Const value above

Extern.ShowWindow hwnd, SW_HIDE

End if

End Function

b.     Get the Print Log text:

 

 

Public Function GetPrintWindowText()

GetPrintWindowText = ""

Set QTPlogWindow = Window("regexpwndclass:=Mercury::Qtprn::PrintWindow", "visible:=True:False")

'Check if the Log window exist

If QTPlogWindow.Exist(0) Then

'Get the text from of edit box

GetPrintWindowText = QTPlogWindow.WinEdit("nativeclass:=Edit","visible:=True:False").GetROProperty("text")

End if

End Function

c.     Clearing the Print WindowBlockInput Method

'API Declaration for SendMessage

Extern.Declare micLong,"SendMessage","user32","SendMessageA",micLong,micLong,micLong,micRef+micLong

'Message to Set text of a window

Const WM_SETTEXT = &HC

'Function to clear the print Log window

Public Function ClearPrintWindow()

'Check if the print Log window exists or not

Set QTPlogWindow = Window("regexpwndclass:=Mercury::Qtprn::PrintWindow","visible:=True|False")

If QTPlogWindow.Exist(0) Then

'Get the handle of edit box

'It is important to use "visible:=True|False" here also as the

'for a hidden window the edit is also hidden

hwnd = QTPlogWindow.WinEdit("nativeclass:=Edit","visible:=True|False").GetROProperty("hwnd")

'Send a message to clear the text box text

Extern.SendMessage hwnd, WM_SETTEXT, 0, 0

End if

End Function

'Use the function to clear the window

Call ClearPrintWindow

29.4 micRegExpMatch Object

3 methods supported:

Initialize : Assigns the regular expression pattern to be testd;

Compare: compare it with value and return Boolean value;

ToString: Get the string description of the operation;

Here is the example:

micRegExpMatch.Initialize("test.*")

print micRegExpMatch.Compare("testing")

print micRegExpMatch.Compare("System testing")

print micRegExpMatch.ToString()

29.5 MercuryTimers:

MercuryTimers is the objects allow us create various times.

There are 5 methods supported:

Start: start the timer

Continue: Continue the timer

ElapsedTime: Returns the total accumulated time in milliseconds since the timer started.

Reset: Reset the timer

Stop: stop the timer

Here is the example:

MercuryTimers.Timer("Time1").Start

Print MercuryTimers.Timer("Time1").ElapsedTime

MercuryTimers.Timer("Time1").Stop

29.6 RepositoriesCollection

A collectionobject that enables you to programmatically manage the run-time collection ofshared object repository files associated with the current action.

There are 7 methods supported:

Add Method: Add a share repository

Find Method: find a share repository

MoveToPos Method: Moves the object repository file entry from the current index position to the specified new index position within the run-time collection of shared object repository files associated with the current action.

Remove Method: remove a share repository

RemoveAll Method: remove all share repository

Count Property: count of share repositories

Item Property: Returns the path of the object repository file located in the specified index position within the run-time collection of shared object repository files associated with the current action.

Here is the example:

RepositoriesCollection.RemoveAll

RepositoriesCollection.Add "C:\test1.tsr"

 

QTP - 29 What’s New in QTP QTP的一些功能介绍相关推荐

  1. 谁说QTP不能多线程 - 当Python遇上QTP

    谁说QTP不能多线程 - 当Python遇上QTP 作者:Wally Yu (微博:http://weibo.com/quicktest) 经常有人问我一个问题:QTP可以同时做多个项目的自动化吗?我 ...

  2. qtp启动java程序_转: QTP六脉神剑之调用Java程序

    查看( 1147 ) / 评论( 21 ) 六脉神剑之调用程 序0Xp1zLN_0版权声明:原创作品,转载请以链接方式注明出自http://www.51testing.com/?35,否则将追究法律责 ...

  3. QTP提供的编程接口实现对QTP操作

    我们可以通过调用 Automation Object Model 里的对象接口 ,来实现对QTP 的操作,如打开 /运行脚本等动作 Automation object model 的对象结构图如下 ( ...

  4. 构建 QC + QTP 自动化测试框架 2:QC 与 QTP 安装

    QC 的安装 关于QC得下载和破解的资源很多,这里就不多叙述了,只谈一下安装时可能碰到的问题.平台用的是 Windows server 2008+SQL Server 2005 开发版. 一路默认,应 ...

  5. web test automation test / QTP / IBM RFT / Selenium IDE / IOS appium / AU3

    Selenium WebDriver / Selenium IDE http://www.ibm.com/developerworks/cn/web/1306_chenlei_webdriver/ S ...

  6. QTP自动化测试权威指南(第二版)

    <QTP自动化测试权威指南(第二版)> 基本信息 原书名:QuickTest Professional Unplugged: 2nd Edition 作者: (印度)Tarun Lalwa ...

  7. 亿能测试-QTP自动化测试系列视频-汇总

    视频: 第1讲-安装目录分析[QTP自动化测试视频系列_亿能测试] http://www.automationqa.com/forum.php?mod=viewthread&tid=1146& ...

  8. QTP脚本汇总比较有价值

    1.Object Spy的Tips Hold the CTRL key to change the window focus or perform other mouse operations  2. ...

  9. QTP自动化测试视频系列

    第1讲-安装目录分析 第2讲-认识QTP操作窗体 第3讲-QTP示例程序业务讲解 第4讲-QTP高手进阶指南 第5讲-初试QTP脚本录制回放 第6讲-QTP脚本增强与调试 第7讲-QTP的三种录制模式 ...

最新文章

  1. Spatial As Deep: Spatial CNN for Traffic Scene Understanding论文翻译
  2. 引路蜂地图API:Drawing包定义
  3. linux ram 权限,我如何将Linux二进制文件限制为有限的RAM数量?
  4. 进入Linux单用户模式
  5. 2005年2月24日(星期四) 中午,晴+煙 - Central Incubator。
  6. 第四次博客作业:bookstore缺陷报告
  7. Could not load driverClass ${jdbc.driver}
  8. androidpn的学习研究(四)androidpn-client客户端几个类说明
  9. Android修改了sdk里面的apk编译push进机器不生效问题
  10. 华三中各种路由协议的缺省优先级
  11. AWS表示:我们将用Lambda函数让移动应用程序再次变得伟大
  12. STM32工作笔记0046---认识杜邦线_以及如何区分杜邦线公母_以及排线和杜邦线的区别
  13. 选择深度学习的GPU卡
  14. md5是什么,md5的这些作用你都知道吗
  15. Android常用控件-01
  16. MT7620设置GPIO输入中断
  17. 计算机毕业设计ssm+vue基本微信小程序的拼车自助服务小程序
  18. 安卓Apk安装出错:更新包与已安装应用的签名不一致,但在应用管理中却找不到这个已经卸载的应用
  19. vba 连接access数据库 方法二
  20. SQL 使用ADD_MONTHS或ADDDATE实现RFM参数—R(Recency)

热门文章

  1. 【Nmap的使用方法】
  2. Netty学习二:Netty整体框架
  3. stop slave mysql_mysql8 参考手册--STOP SLAVE语句
  4. Redis源码解析(15) 哨兵机制[2] 信息同步与TILT模式
  5. 并发编程-并发编程的挑战
  6. interrupt using
  7. 埃森哲java转sfdc_【SFDC salesforce职责】2021年埃森哲SFDC salesforce岗位职责-看准网...
  8. 【读书笔记】Haskell函数式编程入门 I 基础篇 2. 类型系统和函数
  9. 手撸Spring系列4:IOC/DI 思想(实战篇)
  10. 在我们使用vue-admin-templete进行二次开发的时候,我们会发现有些是英文,比如分页里面的每页尺码。