• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • QTP描述性編程

    發表于:2011-04-21來源:不詳作者:領測軟件測試網采編點擊數: 標簽:
    在QTP中使用描述性編程是一個提高QTP腳本利用率的很好的方式。通常QTP是通過對象庫來識別不同的對象,而描述性編程是QTP另外一種能夠識別對象的途徑,它不依賴于對象庫,通過增加一些對象的描述來識別對象的。 說明:本例子是以Flight飛機訂票系統的登陸界面

      在QTP中使用描述性編程是一個提高QTP腳本利用率的很好的方式。通常QTP是通過對象庫來識別不同的對象,而描述性編程是QTP另外一種能夠識別對象的途徑,它不依賴于對象庫,通過增加一些對象的描述來識別對象的。

      說明:本例子是以Flight飛機訂票系統的登陸界面為測試頁面進行描述的。

      步驟一:錄制腳本

      Dialog("Login").WinEdit("Agent Name:").Set "Holly"

      Dialog("Login").WinEdit("Password:").SetSecure "46ef0dc7efe5834c73673898279af1204fea51a7"

      Dialog("Login").WinButton("Cancel").Click

      共錄制3步操作,輸入Agent Name, Password, 點擊Cancel按鈕

      步驟二:初級描述性編程

      Dialog("Regexpwndtitle:=Login").WinEdit("Attached text:=Agent Name:").Set "zhangsan"

      Dialog("Regexpwndtitle:=Login").WinEdit("Attached text:=Password:").Set "mercury"

      Dialog("Regexpwndtitle:=Login").WinButton("Class Name:=WinButton", "text:=Cancel").C

      在這里要注意有三點:

      1)如果需要兩個以上特性來描述一個對象,需要使用逗號(,)對描述性語言進行分割

      2)使用:=來連接屬性和屬性值,并且:=兩邊不能有空格

      3)使用SPY查看對象的屬性名和屬性值(Tools -> Object Spy)

      步驟三:描述性編程提高

      Dim descEditLogin

      Set descEditLogin = Description.Create()

      descEditLogin("Class Name").Value = "Dialog"

      descEditLogin("Regexpwndtitle").Value = "Login"

      Dialog(descEditLogin).WinEdit("Attached text:=Agent Name:").Set "Holly"

      Dialog(descEditLogin).WinEdit("Attached text:=Password:").Set "Mercury"

      Dialog(descEditLogin).WinButton("Class Name:=WinButton", "text:=Cancel").Click

      在這里需要注意有兩點:

      1)把經常使用到的對象定義為一個對象變量,方便以后調用,減少代碼工作量和錯誤

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>