51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 3032|回复: 11
打印 上一主题 下一主题

[原创] 录制的脚本,哪些可以去除?

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2010-7-13 09:29:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我录制了一个登陆操作,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;
}
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2010-7-13 10:14:25 | 只看该作者
楼主注释掉的脚本应该是显示登录后的页面,去掉的话应该不能反映真实的模拟情况。如果响应时间很慢的话,证明程序处理并发登录的时候会有瓶颈。
回复 支持 反对

使用道具 举报

  • TA的每日心情
    奋斗
    2022-5-8 19:23
  • 签到天数: 137 天

    连续签到: 1 天

    [LV.7]测试师长

    3#
    发表于 2010-7-13 20:48:52 | 只看该作者
    如果只是看应用的响应情况,可以把图片之类的去掉,不用压
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    4#
    发表于 2010-7-14 08:54:43 | 只看该作者
    事务函数使用的位置不太合理
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    5#
     楼主| 发表于 2010-7-14 09:30:18 | 只看该作者
    原帖由 云层 于 2010-7-14 08:54 发表
    事务函数使用的位置不太合理

    应该放在什么位置才合理?能说的详细点吗?
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2022-5-8 19:23
  • 签到天数: 137 天

    连续签到: 1 天

    [LV.7]测试师长

    6#
    发表于 2010-7-15 21:20:04 | 只看该作者
    包含登陆的submit函数就行了
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    7#
    发表于 2010-7-16 09:32:33 | 只看该作者
    顶下!
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    8#
    发表于 2010-7-16 10:06:39 | 只看该作者
    第一个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,
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    9#
    发表于 2010-7-16 11:08:45 | 只看该作者

    回复 1# 的帖子

    你设置的事务这么多,响应时间当然长了
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    擦汗
    2016-10-27 09:19
  • 签到天数: 4 天

    连续签到: 1 天

    [LV.2]测试排长

    10#
    发表于 2010-7-16 11:31:48 | 只看该作者
    正在学习LR,帮忙顶
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    11#
    发表于 2010-7-16 11:59:43 | 只看该作者
    这要看怎么定义登录场景了,如果只是看点击登录按钮服务器的响应,确实可以只将web_submit_form这一步定义为事务;
    但是从用户的角度来看,点击登录后,只有加载完首页,呈现完整页面或者主要元素(菜单、欢迎信息等等)展现给用户,用户才会认为是登录完成,所以如果是这样定义登录场景我觉得应该包括至少登录后的main页面。
    另外也许用户觉得登录慢是因为登录后的首页加载元素太多导致的,这时也许应该做做页面细分,看看登录后的页面元素或者控件啥的是否有导致用户体验慢的问题。
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2022-5-8 19:23
  • 签到天数: 137 天

    连续签到: 1 天

    [LV.7]测试师长

    12#
    发表于 2010-7-16 20:54:20 | 只看该作者

    回复 8# 的帖子

    可以删除的
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-9-20 16:44 , Processed in 0.125402 second(s), 28 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表