QTP測試多個Windows應用程式的解決方案
relevantcodes.com的《QTP: Working With Multiple Windows Applications》這篇文章介紹瞭如何測試多個相同Windows應用程式的方法:
http://relevantcodes.com/qtp-working-with-multiple-windows-applications/
其核心思想是把出現的視窗控制程式碼存到陣列中,並給視窗一個指定的名字,這樣後面訪問視窗物件時,只要指定名字就可以了。
核心類colWindows封裝在名為clsWindow.qfl的函式庫檔案中,主要由以下函式組成:
LaunchAdd: Launch a new window and retain its reference throughout the test cycle
AddNew: Automatically add a new open window to the collection without you having to specify its properties (see list of dependencies)
AddCustom: Adds a custom window by specifying its properties as an array
使用例子如下所示(其中WindowObject就是由colWindows類產生的物件):
'Please make sure the library file (clsWindow.qfl) is associated with the test.
'clsWindow.qfl is located in the test's directly: /clsWindow95Demo/clsWindow.qfl
'=================================
'============================================
'LaunchAdd
'============================================
'Open the AUT and add it to our collection as "Flight1"
'If using 9.2 and below:
WindowObject.LaunchAdd "C:/Program Files/HP/QuickTest Professional/samples/flight/app/flight4a.exe", "Flight1"
'If using 9.5 and higher:
'WindowObject.LaunchAdd "C:/Program Files/HP/QuickTest Professional/samples/flight/app/flight4a.exe", "Flight1"
'Use the reference we gave in the previous statement (Flight1):
With WindowObject.Name("Flight1")
.WinEdit("attached text:=Agent Name:").Set "mercury"
.WinEdit("attached text:=Password:").Set "mercury"
.WinButton("text:=OK").Click
End With
'============================================
'AddCustom
'============================================
MsgBox "Demonstrating AddCustom: It will add the windows, whose properties we specify through an array."
'Add a custom window by specifying its description as FlightReservation2
WindowObject.AddCustom Array("regexpwndtitle:=Flight Reservation", "index:=1"), "FlightReservation2"
With WindowObject.Name("FlightReservation2")
.Highlight
.WinObject("attached text:=Date of Flight:", "index:=0").Type "09/09/12"
.WinComboBox("attached text:=Fly From:", "index:=0").Select "Denver"
.WinComboBox("attached text:=Fly To:", "index:=0").Select "Frankfurt"
.WinButton("text:=FLIGHT").Click
End With
Dialog("micclass:=Dialog").WinButton("text:=OK").Click
With WindowObject.Name("FlightReservation2")
.WinEdit("attached text:=Name:", "index:=0").Type "Relevant Codes 2"
.WinButton("text:=&Insert Order").Click
.WinObject("nativeclass:=AfxWnd40").WaitProperty "regexpwndtitle", "Insert Done...", 30000
End with
'============================================
'LaunchAdd
'============================================
'Open another instance of our AUT and add it to our collection as "Flight2"
'If using 9.2 and below:
WindowObject.LaunchAdd "C:/Program Files/HP/QuickTest Professional/samples/flight/app/flight4a.exe", "Flight2"
'If using 9.5 and higher:
'WindowObject.LaunchAdd "C:/Program Files/HP/QuickTest Professional/samples/flight/app/flight4a.exe", "Flight2"
'Use the reference we gave in the previous statement (Flight2):
With WindowObject.Name("Flight2")
.WinEdit("attached text:=Agent Name:").Set "mercury"
.WinEdit("attached text:=Password:").Set "mercury"
.WInButton("text:=OK").Click
End With
'============================================
'AddNew
'============================================
MsgBox "Demonstrating AddNew: It will automatically add the newly open window and execute a few statements."
'Add the last open window to the collection as "FlightReservation1"
WindowObject.AddNew "FlightReservation1", 20
With WindowObject.Name("FlightReservation1")
.Highlight
.WinObject("attached text:=Date of Flight:", "index:=0").Type "09/09/12"
.WinComboBox("attached text:=Fly From:", "index:=0").Select "Denver"
.WinComboBox("attached text:=Fly To:", "index:=0").Select "Frankfurt"
.WinButton("text:=FLIGHT").Click
End With
Dialog("text:=Flights Table").WinButton("text:=OK").Click
With WindowObject.Name("FlightReservation1")
.WinEdit("attached text:=Name:", "index:=0").Type "Relevant Codes 1"
.WinButton("text:=&Insert Order").Click
.WinObject("nativeclass:=AfxWnd40").WaitProperty "regexpwndtitle", "Insert Done...", 30000
End with
'Release object
WindowObject.Destroy
相關文章
- QTP測試多個瀏覽器視窗的解決方案QT瀏覽器
- QTP測試Windows計算器QTWindows
- 用Watir測試QTP的Demo程式Mercury ToursQT
- Rational Functional Tester 測試 Web 應用程式中的常見問題及解決方案FunctionWeb
- 介面測試的解決方案
- 討論一個應用的解決方案
- 請教怎樣測試工具類的 windows 應用程式?Windows
- Invicti v24.3.0 for Windows - Web 應用程式安全測試WindowsWeb
- Invicti v24.4.0 for Windows - Web 應用程式安全測試WindowsWeb
- 應用程式退休(Application Retirement)解決方案APPREM
- iOS應用程式多語言&本地化解決方案iOS
- 基於多語言的跨平臺靜態測試解決方案
- iOS應用程式瘦身的靜態庫解決方案iOS
- 串列埠通訊應用程式的解決方案 (轉)串列埠
- QTP測試Yahoo郵箱QT
- QTP呼叫外部應用程式的4種方法QT
- 滲透測試工具多個應用場合介紹
- 解決多project的angular應用單元測試報 ChromeHeadlessCI未註冊的錯誤ProjectAngularChrome
- Rational的Linux應用程式開發解決方案(轉)Linux
- 介面自動化測試解決方案
- 【軟體測試自動化-QTP系列講座 5】== DOM技術的應用 ==QT
- Web應用程式測試的工具selenium用法詳解Web
- 用QTP進行GMail郵箱的自動化測試QTAI
- 玩轉用例設計:XMind2TestCase一個高效的測試用例設計解決方案
- 多卡聚合路由裝置海上通訊應用解決方案路由
- Sencha應用程式的UI測試 薦UI
- oracle一個process對應多個session測試OracleSession
- 編寫可測試的Javascript程式碼(1):反模式及其解決方案JavaScript模式
- QTP測試QQ登入介面QT
- QTP測試WinToolbar控制元件QT控制元件
- 8個實用且免費的Web應用程式安全測試工具Web
- QTP測試AJAX時的等待問題QT
- WeTest重磅推出雲測試專有云解決方案,助力企業打造全球精品應用
- 智慧座艙模擬測試解決方案
- 車聯網模擬測試解決方案
- 車輛OTA模擬測試解決方案
- 基於hudson分散式測試解決方案分散式
- Android自動化測試解決方案Android