测试积点老人 发表于 2018-12-13 15:38:17

QTP11.5版本下4种录制方式

第一种录制方式:
模拟录制 (analog recording)
'Desktop.RunAnalog "Track2"

static/image/hrline/line6.png


'第二种录制方式:
正常录制(normal recording)

'Dialog("Login").WinEdit("Agent Name:").Type "t" @@ hightlight id_;_1837320_;_script infofile_;_ZIP::ssf14.xml_;_
'Dialog("Login").WinEdit("Agent Name:").Type "1" @@ hightlight id_;_1837320_;_script infofile_;_ZIP::ssf15.xml_;_
'Dialog("Login").WinEdit("Agent Name:").Set "test12" @@ hightlight id_;_1837320_;_script infofile_;_ZIP::ssf16.xml_;_
'Dialog("Login").WinEdit("Password:").Type "m" @@ hightlight id_;_2951234_;_script infofile_;_ZIP::ssf17.xml_;_
'Dialog("Login").WinEdit("Password:").Type "r" @@ hightlight id_;_2951234_;_script infofile_;_ZIP::ssf18.xml_;_
'Dialog("Login").WinEdit("Password:").Type "c" @@ hightlight id_;_2951234_;_script infofile_;_ZIP::ssf19.xml_;_
'Dialog("Login").WinEdit("Password:").SetSecure "513d77e068a8f53bec26bb5e9518bc374ec3" @@ hightlight id_;_2951234_;_script infofile_;_ZIP::ssf20.xml_;_

static/image/hrline/line6.png


第三种录制方式:
低级录制(low-level recording),包括鼠标位置和业务逻辑,相对位置等。占用更大的硬盘空间。

'Window("Login").WinObject("Agent Name:").Click 78,8
'Window("Login").WinObject("Agent Name:").Type "st" @@ hightlight id_;_2164986_;_script infofile_;_ZIP::ssf22.xml_;_
'Dialog("Login").Click 82,19 @@ hightlight id_;_2689364_;_script infofile_;_ZIP::ssf24.xml_;_
'Window("Login").WinObject("Agent Name:").Type "te" @@ hightlight id_;_2164986_;_script infofile_;_ZIP::ssf25.xml_;_
'Window("Login").WinObject("Agent Name:").Type "1" @@ hightlight id_;_2164986_;_script infofile_;_ZIP::ssf26.xml_;_
'Window("Login").WinObject("Agent Name:").Type "2" @@ hightlight id_;_2164986_;_script infofile_;_ZIP::ssf27.xml_;_
'Window("Login").WinObject("Agent Name:").Type "3" @@ hightlight id_;_2164986_;_script infofile_;_ZIP::ssf28.xml_;_
'Window("Login").WinObject("Password:").Click 44,6 @@ hightlight id_;_2033882_;_script infofile_;_ZIP::ssf29.xml_;_
'Window("Login").WinObject("Password:").Type "m" @@ hightlight id_;_2033882_;_script infofile_;_ZIP::ssf30.xml_;_
'Window("Login").WinObject("Password:").Type "e" @@ hightlight id_;_2033882_;_script infofile_;_ZIP::ssf31.xml_;_
'Window("Login").WinObject("Password:").Type "r" @@ hightlight id_;_2033882_;_script infofile_;_ZIP::ssf32.xml_;_
'Window("Login").WinObject("Password:").Type "c" @@ hightlight id_;_2033882_;_script infofile_;_ZIP::ssf33.xml_;_
'Window("Login").WinObject("Password:").Type "u" @@ hightlight id_;_2033882_;_script infofile_;_ZIP::ssf34.xml_;_
'Window("Login").WinObject("Password:").Type "r" @@ hightlight id_;_2033882_;_script infofile_;_ZIP::ssf35.xml_;_
'Window("Login").WinObject("Password:").Type "y"


'Dialog("Login").Activate @@ hightlight id_;_1968090_;_script infofile_;_ZIP::ssf1.xml_;_
'Dialog("Login").WinEdit("Agent Name:").Type "t" @@ hightlight id_;_1640446_;_script infofile_;_ZIP::ssf2.xml_;_
'Dialog("Login").WinEdit("Agent Name:").Type "e" @@ hightlight id_;_1640446_;_script infofile_;_ZIP::ssf3.xml_;_
'Dialog("Login").WinEdit("Agent Name:").Set "tes" @@ hightlight id_;_1640446_;_script infofile_;_ZIP::ssf4.xml_;_
'Dialog("Login").WinEdit("Agent Name:").Set "test" @@ hightlight id_;_1640446_;_script infofile_;_ZIP::ssf5.xml_;_
'Dialog("Login").WinEdit("Agent Name:").Type "1" @@ hightlight id_;_1640446_;_script infofile_;_ZIP::ssf6.xml_;_
'Dialog("Login").WinEdit("Agent Name:").Set "test1" @@ hightlight id_;_1640446_;_script infofile_;_ZIP::ssf7.xml_;_
'Dialog("Login").WinEdit("Password:").Type "m" @@ hightlight id_;_2295642_;_script infofile_;_ZIP::ssf8.xml_;_
'Dialog("Login").WinEdit("Password:").Type "e" @@ hightlight id_;_2295642_;_script infofile_;_ZIP::ssf9.xml_;_
'Dialog("Login").WinEdit("Password:").Type "r" @@ hightlight id_;_2295642_;_script infofile_;_ZIP::ssf10.xml_;_
'Dialog("Login").WinEdit("Password:").Type "c" @@ hightlight id_;_2295642_;_script infofile_;_ZIP::ssf11.xml_;_
'Dialog("Login").WinEdit("Password:").Type "u" @@ hightlight id_;_2295642_;_script infofile_;_ZIP::ssf12.xml_;_
'Dialog("Login").WinEdit("Password:").Type "y" @@ hightlight id_;_2295642_;_script infofile_;_ZIP::ssf13.xml_;_
'

static/image/hrline/line6.png


'第四种录制方式:
insight recording(支持智能图像识别的录制方式) 也是QTP11.5版本新增加的一种录制方式,
对游戏测试是一个福音。【第4种的代码图片】如下所示:
录制的程序界面如下图:



在QTP中的代码界面如下图:



其中的对象识别是基于对于图像的识别技术,对象除了父对象,其余都是InsightObject形式。
<p>Browser("Flash Calculator").InsightObject("InsightObject_digit_1").Click @@ hightlight id_;_4_;_script infofile_;_ZIP::ssf6.xml_;_</p><p>Browser("Flash Calculator").InsightObject("InsightObject_2_operator_+").Click @@ hightlight id_;_9_;_script infofile_;_ZIP::ssf7.xml_;_</p><p>Browser("Flash Calculator").InsightObject("InsightObject_digit_3").Click @@ hightlight id_;_15_;_script infofile_;_ZIP::ssf8.xml_;_</p><p>Browser("Flash Calculator").InsightObject("InsightObject_operator_=").Click</p>


Miss_love 发表于 2021-1-5 16:58:41

支持分享
页: [1]
查看完整版本: QTP11.5版本下4种录制方式