51Testing软件测试论坛

标题: 录制的脚本,哪些可以去除? [打印本页]

作者: zengli80    时间: 2010-7-13 09:29
标题: 录制的脚本,哪些可以去除?
我录制了一个登陆操作,1个用户登陆用时2秒,50个并发就用了56秒,代码如下,我觉得太慢了,所以把web_submit_form后面的代码给注释掉了,50个并发就只要17秒,不知这样是不是能否真实反映登陆?

#include "web_api.h"


Action()
{
        web_url("pcoms_xss",
                "URL=http://test3:8080/pcoms_xss",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=/pcoms_xss/images/skin1/img/business/login_-bt.gif", "Referer=http://test3:8080/pcoms_xss/", ENDITEM,
                "Url=/pcoms_xss/images/skin1/img/business/img_xss/login_pic.jpg", "Referer=http://test3:8080/pcoms_xss/", ENDITEM,
                "Url=/pcoms_xss/images/skin1/img/business/img_xss/login5_11.jpg", "Referer=http://test3:8080/pcoms_xss/", ENDITEM,
                "Url=/pcoms_xss/images/skin1/img/business/img_xss/login_copyright.gif", "Referer=http://test3:8080/pcoms_xss/", ENDITEM,
                LAST);

        //lr_think_time( 9 );

        lr_start_transaction("login");

        //lr_think_time( 2 );

        web_submit_form("login.do;jsessionid=6454F4F09049361F302872D26D601C58",
                "Snapshot=t2.inf",
                ITEMDATA,
                "Name=departId", "Value=", ENDITEM,
                "Name=userId", "Value=", ENDITEM,
                "Name=loginType", "Value=工号", ENDITEM,
                "Name=userAccount", "Value={username}", ENDITEM,
                "Name=password", "Value=123456", ENDITEM,
                "Name=checkbox", "Value=<OFF>", ENDITEM,
                "Name=btnLogin", "Value=登 录", ENDITEM,
                LAST);

        /*web_url("main.do",
                "URL=http://test3:8080/pcoms_xss/main.do",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t3.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=images/skin1/img/business/top_03.gif", "Referer=http://test3:8080/pcoms_xss/main/top.do", ENDITEM,
                "Url=images/skin1/img/business/main_05.gif", "Referer=http://test3:8080/pcoms_xss/main/right.do", ENDITEM,
                "Url=images/skin1/img/business/img_xss/main2_02.gif", "Referer=http://test3:8080/pcoms_xss/main/top.do", ENDITEM,
                "Url=images/skin1/tree/loading_xp.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/img/business/main_bt2.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/img/business/main_bt1.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/04/grmb.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/img/business/main_bottombg.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/04/rcgz.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/01/jcxx.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/loading.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/xp/Tplus.png", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/01/qxkz.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/xp/L.png", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/01/gzl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/xp/Lplus.png", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/01/qtgl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/blank.png", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/xp/I.png", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/01/xtgl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/sbgl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/bzgl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/rcdj.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/zydj.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/jmdj.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/ycgl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/djfx.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/khgl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/djbg.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/dxgl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/jsjd.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/qxgl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/whby.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/pxks.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/gncd.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/02/wdzx1.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/02/wdzx.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/xp/T.png", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/sbgl/sbgl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/04/xgmm.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/bzgl/sbdjbz.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/bzgl/nddjjh.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/zydj/djlxgl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/zydj/jhtgl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/zydj/xzdjjh.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/zydj/jsdjjg.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/02/wdgl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/04/dzmk.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/04/dxx.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/04/ggtz.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/04/swzx.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/xp/Tminus.png", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/04/grzl.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/img/business/ws_headbg.gif", "Referer=http://test3:8080/pcoms_xss/main/workspace.do", ENDITEM,
                "Url=images/skin1/img/business/ws_dot.gif", "Referer=http://test3:8080/pcoms_xss/main/workspace.do", ENDITEM,
                "Url=images/skin1/tree/module/03/zydj/jjrsz.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/tree/module/03/zydj/djsjcx.gif", "Referer=http://test3:8080/pcoms_xss/main/left.do", ENDITEM,
                "Url=images/skin1/popup/spinner.gif", "Referer=http://test3:8080/pcoms_xss/main/right.do", ENDITEM,
                "Url=images/skin1/popup/dialogclose.gif", "Referer=http://test3:8080/pcoms_xss/main/right.do", ENDITEM,
                LAST);

        web_url("listMenu.do",
                "URL=http://test3:8080/pcoms_xss/authm/listMenu.do?parent=0000&pType=business",
                "Resource=0",
                "RecContentType=text/xml",
                "Referer=http://test3:8080/pcoms_xss/main/left.do",
                "Snapshot=t4.inf",
                "Mode=HTML",
                LAST);

        web_url("listMenu.do_2",
                "URL=http://test3:8080/pcoms_xss/authm/listMenu.do?parent=0003&pType=business",
                "Resource=0",
                "RecContentType=text/xml",
                "Referer=http://test3:8080/pcoms_xss/main/left.do",
                "Snapshot=t5.inf",
                "Mode=HTML",
                LAST);

        web_url("listMenu.do_3",
                "URL=http://test3:8080/pcoms_xss/authm/listMenu.do?parent=0002&pType=business",
                "Resource=0",
                "RecContentType=text/xml",
                "Referer=http://test3:8080/pcoms_xss/main/left.do",
                "Snapshot=t6.inf",
                "Mode=HTML",
                LAST);

        web_url("listMenu.do_4",
                "URL=http://test3:8080/pcoms_xss/authm/listMenu.do?parent=0004&pType=business",
                "Resource=0",
                "RecContentType=text/xml",
                "Referer=http://test3:8080/pcoms_xss/main/left.do",
                "Snapshot=t7.inf",
                "Mode=HTML",
                LAST);

        web_custom_request("refresh.do",
                "URL=http://test3:8080/pcoms_xss/ieaa/refresh.do",
                "Method=POST",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://test3:8080/pcoms_xss/main/right.do",
                "Snapshot=t8.inf",
                "Mode=HTML",
                "EncType=",
                LAST);*/


        lr_end_transaction("login", LR_AUTO);



        return 0;
}
作者: ziheng198688    时间: 2010-7-13 10:14
楼主注释掉的脚本应该是显示登录后的页面,去掉的话应该不能反映真实的模拟情况。如果响应时间很慢的话,证明程序处理并发登录的时候会有瓶颈。
作者: msnshow    时间: 2010-7-13 20:48
如果只是看应用的响应情况,可以把图片之类的去掉,不用压
作者: 云层    时间: 2010-7-14 08:54
事务函数使用的位置不太合理
作者: zengli80    时间: 2010-7-14 09:30
原帖由 云层 于 2010-7-14 08:54 发表
事务函数使用的位置不太合理

应该放在什么位置才合理?能说的详细点吗?
作者: msnshow    时间: 2010-7-15 21:20
包含登陆的submit函数就行了
作者: patrick_1984    时间: 2010-7-16 09:32
顶下!
作者: aliceella    时间: 2010-7-16 10:06
第一个web_url中的这些是不是可以删除啊?
"Url=/pcoms_xss/images/skin1/img/business/login_-bt.gif", "Referer=http://test3:8080/pcoms_xss/", ENDITEM,
                "Url=/pcoms_xss/images/skin1/img/business/img_xss/login_pic.jpg", "Referer=http://test3:8080/pcoms_xss/", ENDITEM,
                "Url=/pcoms_xss/images/skin1/img/business/img_xss/login5_11.jpg", "Referer=http://test3:8080/pcoms_xss/", ENDITEM,
                "Url=/pcoms_xss/images/skin1/img/business/img_xss/login_copyright.gif", "Referer=http://test3:8080/pcoms_xss/", ENDITEM,
作者: 苏高跃    时间: 2010-7-16 11:08
标题: 回复 1# 的帖子
你设置的事务这么多,响应时间当然长了
作者: liuhaisheng2008    时间: 2010-7-16 11:31
正在学习LR,帮忙顶
作者: cebio    时间: 2010-7-16 11:59
这要看怎么定义登录场景了,如果只是看点击登录按钮服务器的响应,确实可以只将web_submit_form这一步定义为事务;
但是从用户的角度来看,点击登录后,只有加载完首页,呈现完整页面或者主要元素(菜单、欢迎信息等等)展现给用户,用户才会认为是登录完成,所以如果是这样定义登录场景我觉得应该包括至少登录后的main页面。
另外也许用户觉得登录慢是因为登录后的首页加载元素太多导致的,这时也许应该做做页面细分,看看登录后的页面元素或者控件啥的是否有导致用户体验慢的问题。
作者: msnshow    时间: 2010-7-16 20:54
标题: 回复 8# 的帖子
可以删除的




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2