SilkTest天龍八部系列7-dynamic object recognition 軟件測試
在測試web應用時,我們常常需要面對web頁面對象變化頻繁,并且使用預定義方式識別對象慢的困難。為了解決這些問題,silktest引入了dynamic object recognition技術,它使用xpath來查找和識別界面上的對象。它可以使用Find和FindAll方法來識別這些對象,從而避免了在頁面更改后不得不頻繁改變frame.inc的問題。
下面我用一個簡單的項目來演示一下如何使用dynamic object recognition技術來測試borland提供的web gmo應用。
1. 新建一個xbrowser的project名為gmo
2. 打開IE輸入我們要測試的web頁http://demo.borland.com/gmopost/
3. 在silktest中,點擊工具欄上的enable extensions,在出現的enable extensions對話框中,選擇iexplorer應用的Welcome to Green Mountain Outpost條目。 silktest會自動為其選中win32和xbrowser等extensions功能,你需要點擊"enable extensions"按鈕來激活它。然后點擊close按鈕關閉該對話框。
4. 點擊basic workflow工具欄上的set recovery system按鈕為系統設置一個appstate GMO。這是silktest會自動為你生成一個frame.inc文件,內容如下所示:
view plaincopy to clipboardprint?
01.[ ] const wMainWindow = InternetExplorer
02.[ ]
03.[-] window BrowserApplication InternetExplorer
04. [-] multitag TAG_IS_OPEN_AGENT
05. [ ] "InternetExplorer"
06. [ ]
07. [ ] // The working directory of the application when it is invoked
08. [ ] const sDir = "C:\Documents and Settings\ZengYuetian\桌面"
09. [ ]
10. [ ] // The command line used to invoke the application
11. [ ] const sCmdLine = """C:\Program Files\Internet Explorer\iexplore.exe"" "
12. [ ]
13. [ ] // The first window to appear when the application is invoked
14. [ ] // const wStartup = ?
15. [ ]
16. [ ] // The list of windows the recovery system is to leave open
17.
18. [ ] // const lwLeaveOpen = {?}
19.[ ]
[ ] const wMainWindow = InternetExplorer
[ ]
[-] window BrowserApplication InternetExplorer
[-] multitag TAG_IS_OPEN_AGENT
[ ] "InternetExplorer"
[ ]
[ ] // The working directory of the application when it is invoked
原文轉自:http://www.anti-gravitydesign.com