如何使用iMacros进行web程序中页面加载的性能测试
iMacros 的官方簡(jiǎn)介如下,這里就不做翻譯了,本人覺(jué)得還是看原汁原味的介紹好。
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.接下來(lái)說(shuō)一說(shuō)如何具體操作吧,首先應(yīng)該從iMacros的官網(wǎng)上下載該程序的最新版本,然后安裝到本地就可以了。打開(kāi)后入下圖。
因?yàn)樵撥浖哂袖浿坪突胤诺墓δ?#xff0c;因此我們可以先進(jìn)行對(duì)要測(cè)試頁(yè)面的錄制,然后稍稍對(duì)錄制后的腳本進(jìn)行修改,就可以用來(lái)做頁(yè)面加載的性能測(cè)試了。本例就以登錄google.com 然后搜索iPhone5為例來(lái)進(jìn)行講解。
1. 在地址欄中輸入google.com;
2.點(diǎn)擊iMacros的Record tab;
3.點(diǎn)擊Record button;
4.在搜索框中輸入iPhone5;
5.點(diǎn)擊搜索button;
6. 結(jié)束錄制;
在第六步結(jié)束后我們會(huì)得到一個(gè)名字為#Current.iim的腳本:
VERSION BUILD=7401598
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.google.com/ ? ?{在狀態(tài)欄中輸入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 ??{點(diǎn)擊搜索按鈕}
TAG POS=1 TYPE=B ATTR=TXT:iPhone<SP>5 ??{得到搜索結(jié)果}
TAG POS=1 TYPE=IMG ATTR=SRC:http://images.apple.com/iphone/images/product_title.png ?{確認(rèn)得到iPhone的官網(wǎng)}
這個(gè)時(shí)候如果我們要對(duì)從點(diǎn)擊搜索按鈕到確認(rèn)得到iPhone的官網(wǎng)之間的操作用了多少時(shí)間的話(huà),我們可以對(duì)以上腳本做如下簡(jiǎn)單修改。
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
修改后將要測(cè)試的操作用STOPWATCH包住,然后將該文件命名為IPhone5.iim。然后再次運(yùn)行修改后的腳本就可以得到相應(yīng)的時(shí)候了。看看運(yùn)行一次的結(jié)果時(shí)間是多少。
在如下的目錄查看結(jié)果:C:\Documents and Settings\Administrator\My Documents\iMacros\Downloads\performance_IPhone5.csv
同時(shí)該軟件還提供了重復(fù)運(yùn)行的功能,測(cè)試人員可以修改某一個(gè)腳本運(yùn)行的次數(shù),然后將運(yùn)行的結(jié)果求平均值后就可以得到某一個(gè)頁(yè)面的性能值了。
總結(jié)
以上是生活随笔為你收集整理的如何使用iMacros进行web程序中页面加载的性能测试的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Debugbar工具条安装
- 下一篇: Laravel debugbar 开发调