loadrunner测试ajax例子
测试的例子: http://www.degraeve.com/reference/simple-ajax-example.php 如果用WEB(HTTP/HTML)协议来录制,则AJAX行为会被录制成web_submit_data函数: Action() { web_add_cookie("__utma=251078419.1213328951.1265334283.1265334283.1265339393.2; DOMAIN=www.degraeve.com"); web_add_cookie("__utmz=251078419.1265334283.1.1.utmccn=(referral)|utmcsr=wilsonmar.com|utmcct=/ajax_rec.htm|utmcmd=referral; DOMAIN=www.degraeve.com"); web_add_cookie("__utmb=251078419; DOMAIN=www.degraeve.com"); web_add_cookie("id=22d81daffc0000c9||t=1264953682|et=730|cs=dyerrpt3; DOMAIN=googleads.g.doubleclick.net"); web_add_cookie("session_2522990=1265121155%260; DOMAIN=c14.statcounter.com"); web_add_cookie("session_1469676=1265339396%260; DOMAIN=c14.statcounter.com"); web_url("simple-ajax-example.php", "URL=http://www.degraeve.com/reference/simple-ajax-example.php", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t1.inf", "Mode=HTML", EXTRARES, "Url=../css/20061228/headerbg.jpg",ENDITEM, "Url=http://pagead2.googlesyndication.com/pagead/render_ads.js", "Url=http://googleads.g.doubleclick.net/pagead/test_domain.js", "Url=http://pagead2.googlesyndication.com/pagead/expansion_embed.js", "Url=../css/20061228/external.png", "Url=http://www.geekchart.com/img/geekchart.swf?username=steve", "Url=http://www.google-analytics.com/__utm.gif?utmwv=1.3&utmn=1868440947&utmcs=utf-8&utmsr=1280x800&utmsc=32-bit&utmul=zh-cn&utmje=1&utmfl=10.0%20r42&utmdt=Simple%20Ajax%20Example&utmhn=www.degraeve.com&utmhid=1615848864&utmr=-&utmp=/reference/simple-ajax-example.php&utmac=UA-427894-1&utmcc=__utma%3D251078419.1213328951.1265334283.1265339393.1265339466.3%3B%2B__utmz%3D251078419.1265334283.1.1.utmccn%3D(referral)%7Cutmcsr%3Dwilsonmar.com%7Cutmcct%3D%2Fajax_rec.htm%7Cutmcmd%3Dreferral%3B%2B", "Url=http://c14.statcounter.com/t.php?sc_project=1469676&resolution=1280&h=800&camefrom=&u=http%3A//www.degraeve.com/reference/simple-ajax-example.php&t=Simple%20Ajax%20Example&java=1&security=63fa642a&sc_random=0.49026486354565296&sc_snum=1", LAST); web_url("ads", "URL=http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-1231725161806454&format=468x60_as&output=html&h=60&w=468&lmt=1265339464&channel=5544617423&ad_type=text_image&alt_color=ffffff&color_bg=FFFFFF&color_border=FFFFFF&color_link=0000FF&color_text=000000&color_url=009900&flash=10.0.42.34&url=http%3A%2F%2Fwww.degraeve.com%2Freference%2Fsimple-ajax-example.php&dt=1265339464260&correlator=1265339464291&frm=0&ga_vid=1213328951.1265334283&ga_sid=1265339466&ga_hid=1615848864&ga_fc=1&u_tz=480&" "u_his=0&u_java=1&u_h=800&u_w=1280&u_ah=772&u_aw=1280&u_cd=32&u_nplug=0&u_nmime=0&biw=1260&bih=643&fu=0&ifi=1&dtd=M&xpc=GJiFPth82m&p=http%3A//www.degraeve.com", "Referer=http://www.degraeve.com/reference/simple-ajax-example.php", "Snapshot=t2.inf", LAST); web_url("api.php", "URL=http://www.geekchart.com/api.php?action=getchartdata&username=steve", "Referer=http://www.geekchart.com/img/geekchart.swf?username=steve", "Snapshot=t3.inf", LAST); web_add_cookie("__utma=251078419.1213328951.1265334283.1265339393.1265339466.3; DOMAIN=www.degraeve.com"); web_add_cookie("__utmc=251078419; DOMAIN=www.degraeve.com"); lr_think_time(37); web_submit_data("simple-ajax-example.cgi", "Action=http://www.degraeve.com/cgi-bin/simple-ajax-example.cgi", "Method=POST", "RecContentType=text/html", "Referer=http://www.degraeve.com/reference/simple-ajax-example.php", "Snapshot=t4.inf", "Mode=HTML", ITEMDATA, "Name=w","Value=ajax", LAST); return 0; } 如果用AJAX(Click and Script)协议来录制,则脚本会短很多3个web_url函数被替换成了一个web_browser函数,多个web_add_cookie函数也被一个web_add_cookie_ex函数替代了,ajax行为会被录制成web_edit_field和web_button函数(Click & Script的脚本编写方式更倾向于从用户行为的角度出发,例如在输入框输入、按下按钮等)。 Action() { web_add_cookie_ex("Cookie=__utma=251078419.1213328951.1265334283.1265339393.1265339466.3; domain=degraeve.com; path=/", "Cookie=__utmz=251078419.1265334283.1.1.utmccn=(referral)|utmcsr=wilsonmar.com|utmcct=/ajax_rec.htm|utmcmd=referral; domain=degraeve.com; path=/", "Cookie=__utmb=251078419; domain=degraeve.com; path=/", "Cookie=id=22d81daffc0000c9||t=1264953682|et=730|cs=dyerrpt3; domain=doubleclick.net; path=/", "Cookie=apn-user-id=b4d43f6a-a0d4-4f23-9315-ceb1d859b971; domain=amazon.com; path=/", LAST); web_browser("simple-ajax-example.php", DESCRIPTION, ACTION, "Navigate=http://www.degraeve.com/reference/simple-ajax-example.php", LAST); lr_think_time(27); web_edit_field("word", "Snapshot=t1.inf", DESCRIPTION, "Type=text", "Name=word", ACTION, "SetValue=ajax", LAST);
web_button("INPUT", "Snapshot=t2.inf", "Type=button", "Tag=INPUT", "ID=", "UserAction=Click", LAST); return 0; } 但是,似乎这样录制的HTTP请求内容会少一些,例如对以下URL的请求不能在回放日志中找到: http://www.geekchart.com/api.php?action=getchartdata&username=steve 在使用WEB(HTTP/HTML)协议来录制时是这行脚本: web_url("api.php", "Snapshot=t7.inf", LAST); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- Postgresql:如何在不使用中间hstore的情况下将键值表转换为
- PostgreSQL的资料与日常交流介绍
- application/xml和text/xml的区别
- postgresql – 如何添加“关于删除级联”约束?
- React Native 环境搭建for macOS
- xml – 如何将drawableTop和文本垂直居中在Android的Button
- c# – UseWindowsAzureActiveDirectoryBearerAuthenticatio
- 深入分析基类定义 --以Cocos2d-x游戏开发之旅为例 课本第
- ruby-on-rails – 我如何在rails上的ruby中生成mongoid.yml
- sqlite建立inner join 查询