如何使用iMacros进行web程序中页面加载的性能测试
iMacros 的官方簡介如下,這里就不做翻譯了,本人覺得還是看原汁原味的介紹好。
iMacros?is an extension for the Mozilla Firefox web browsers which adds record and replay functionality similar to that found in web testing and form filler software. The macros can be combined and controlled via Javascript. The extension was developed by iOpus. The current stable release of iMacros is version 0.9.0.2, released on July 7, 2007. As of July 14, 2007 iMacros is one of the TOP 10 most popular Firefox extensions in the Bookmark, Web Data, Alerts, and Widgets and Social and Sharing categories.
iMacros is also available as a free Internet Explorer Add-On and (with additional features) as commercial application for Web Scripting, Web Scraping and Web Testing. The Scripting Interface of the iMacros Scripting Edition is a COM object and allows the user to remote control (script) the Internet Explorer and Firefox web browser from any Windows programming or scripting language.接下來說一說如何具體操作吧,首先應該從iMacros的官網上下載該程序的最新版本,然后安裝到本地就可以了。打開后入下圖。
因為該軟件具有錄制和回放的功能,因此我們可以先進行對要測試頁面的錄制,然后稍稍對錄制后的腳本進行修改,就可以用來做頁面加載的性能測試了。本例就以登錄google.com 然后搜索iPhone5為例來進行講解。
1. 在地址欄中輸入google.com;
2.點擊iMacros的Record tab;
3.點擊Record button;
4.在搜索框中輸入iPhone5;
5.點擊搜索button;
6. 結束錄制;
在第六步結束后我們會得到一個名字為#Current.iim的腳本:
VERSION BUILD=7401598
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.google.com/ ? ?{在狀態欄中輸入google}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:gbqf ATTR=ID:gbqfq CONTENT=iPhone5 ??{在搜索欄中輸入iPhone5}
TAG POS=1 TYPE=BUTTON:SUBMIT FORM=ID:gbqf ATTR=ID:gbqfb ??{點擊搜索按鈕}
TAG POS=1 TYPE=B ATTR=TXT:iPhone<SP>5 ??{得到搜索結果}
TAG POS=1 TYPE=IMG ATTR=SRC:http://images.apple.com/iphone/images/product_title.png ?{確認得到iPhone的官網}
這個時候如果我們要對從點擊搜索按鈕到確認得到iPhone的官網之間的操作用了多少時間的話,我們可以對以上腳本做如下簡單修改。
VERSION BUILD=7401598
TAB T=1
TAB CLOSEALLOTHERS
SET !TIMEOUT_STEP 20
SET !REPLAYSPEED FAST
URL GOTO=http://www.google.com/
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:gbqf ATTR=ID:gbqfq CONTENT=iPhone5
STOPWATCH ID=iPhone5
TAG POS=1 TYPE=BUTTON:SUBMIT FORM=ID:gbqf ATTR=ID:gbqfb
TAG POS=1 TYPE=B ATTR=TXT:iPhone<SP>5
TAG POS=1 TYPE=IMG ATTR=SRC:http://images.apple.com/iphone/images/product_title.png
STOPWATCH ID=iPhone5
修改后將要測試的操作用STOPWATCH包住,然后將該文件命名為IPhone5.iim。然后再次運行修改后的腳本就可以得到相應的時候了。看看運行一次的結果時間是多少。
在如下的目錄查看結果:C:\Documents and Settings\Administrator\My Documents\iMacros\Downloads\performance_IPhone5.csv
同時該軟件還提供了重復運行的功能,測試人員可以修改某一個腳本運行的次數,然后將運行的結果求平均值后就可以得到某一個頁面的性能值了。
總結
以上是生活随笔為你收集整理的如何使用iMacros进行web程序中页面加载的性能测试的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Debugbar工具条安装
- 下一篇: Laravel debugbar 开发调