SilkTest天龍八部系列7-dynamic object recognition 軟件測試
在測試web應用時(shí),我們常常需要面對web頁(yè)面對象變化頻繁,并且使用預定義方式識別對象慢的困難。為了解決這些問(wèn)題,silktest引入了dynamic object recognition技術(shù),它使用xpath來(lái)查找和識別界面上的對象。它可以使用Find和FindAll方法來(lái)識別這些對象,從而避免了在頁(yè)面更改后不得不頻繁改變frame.inc的問(wèn)題。
下面我用一個(gè)簡(jiǎn)單的項目來(lái)演示一下如何使用dynamic object recognition技術(shù)來(lái)測試borland提供的web gmo應用。
1. 新建一個(gè)xbrowser的project名為gmo
2. 打開(kāi)IE輸入我們要測試的web頁(yè)http://demo.borland.com/gmopost/
3. 在silktest中,點(diǎn)擊工具欄上的enable extensions,在出現的enable extensions對話(huà)框中,選擇iexplorer應用的Welcome to Green Mountain Outpost條目。 silktest會(huì )自動(dòng)為其選中win32和xbrowser等extensions功能,你需要點(diǎn)擊"enable extensions"按鈕來(lái)激活它。然后點(diǎn)擊close按鈕關(guān)閉該對話(huà)框。
4. 點(diǎn)擊basic workflow工具欄上的set recovery system按鈕為系統設置一個(gè)appstate GMO。這是silktest會(huì )自動(dòng)為你生成一個(gè)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
文章來(lái)源于領(lǐng)測軟件測試網(wǎng) http://kjueaiud.com/