[ ] const sDir = "C:\Documents and Settings\ZengYuetian\桌面"
[ ]
[ ] // The command line used to invoke the application
[ ] const sCmdLine = """C:\Program Files\Internet Explorer\iexplore.exe"" "
[ ]
[ ] // The first window to appear when the application is invoked
[ ] // const wStartup = ?
[ ]
[ ] // The list of windows the recovery system is to leave open
[ ] // const lwLeaveOpen = {?}
[ ]
5.現在你需要手工加入一個appstate GMO
[-] appstate GMO() basedon DefaultBaseState
[ ] window browser = InternetExplorer.Find(".//BrowserWindow")
[ ] browser.navigate("http://demo.borland.com/gmopost/")
它的意義在于運行這個appstate會讓瀏覽器自動導航至待測web頁面http://demo.borland.com/gmopost/。同時我們還應該注意到其第二行中使用了Find函數來查找一個XPath為.//BrowserWindow的控件,該控件并未在我們的frame.inc中聲明,這就是dynamic object recognition技術和通常我們用的先定義控件后使用的方法最大不同。
6. 新建一個testcase文件gmo_test.t,用record菜單下面的window identifiers來識別頁面上的enter GMO online按鈕,這個時候你會采集到如下的dynamic object recognition ".//DomButton[@language='JavaScript' and @type='button' and @name='bSubmit' and @value='Enter GMO OnLine']",這個就是該按鈕的的XPath,我們并不需要所有的內容,只需要能夠唯一標識該按鈕的一部分內容,這里我們選擇.//DomButton[@name='bSubmit']即可。
7. 在gmo_test.t中輸入下面的內容,該測試用例用來進入gmo online page
view plaincopy to clipboardprint?
01.[-] testcase goto_online() appstate GMO
02. [ ] window browser = InternetExplorer.find(".//BrowserWindow")
03. [ ] browser.find(".//DomButton[@name='bSubmit']").click()
[-] testcase goto_online() appstate GMO
[ ] window browser = InternetExplorer.find(".//BrowserWindow")
[ ] browser.find(".//DomButton[@name='bSubmit']").click()
8. 運行一下,看看測試用例是否帶我們進入了http://demo.borland.com/gmopost/online-catalog.htm頁面。
文章來源于領測軟件測試網 http://www.kjueaiud.com/