51Testing软件测试论坛

标题: 我是初学者=loadrunner 注册脚本/参数化/关联求助 [打印本页]

作者: zhuy82    时间: 2018-9-5 14:12
标题: 我是初学者=loadrunner 注册脚本/参数化/关联求助
初学者,自己还无法写代码,自己手动注册了一个账户,

如果修改以下代码实现自动注册呢? 目前只进行了数值的参数化

Action()
{

    web_add_cookie("02rE_2132_sid=kP729P; DOMAIN=39.105.47.72");

    web_add_cookie("02rE_2132_saltkey=egtX7gHt; DOMAIN=39.105.47.72");

    web_add_cookie("02rE_2132_lastvisit=1536122095; DOMAIN=39.105.47.72");

    web_add_cookie("02rE_2132_lastact=1536125695%09home.php%09misc; DOMAIN=39.105.47.72");

    web_url("forum.php",
        "URL=http://39.105.47.72/bbs/upload/forum.php",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=",
        "Snapshot=t13.inf",
        "Mode=HTML",
        LAST);

    web_url("立即注册",
        "URL=http://39.105.47.72/bbs/upload/member.php?mod=register",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://39.105.47.72/bbs/upload/forum.php",
        "Snapshot=t14.inf",
        "Mode=HTML",
        LAST);

    lr_think_time(4);

    web_url("forum.php_2",
        "URL=http://39.105.47.72/bbs/upload/forum.php?mod=ajax&inajax=yes&infloat=register&handlekey=register&ajaxmenu=1&action=checkusername&username=dukertest",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/xml",
        "Referer=http://39.105.47.72/bbs/upload/member.php?mod=register",
        "Snapshot=t15.inf",
        "Mode=HTML",
        LAST);

    lr_think_time(9);

    web_url("forum.php_3",
        "URL=http://39.105.47.72/bbs/upload/forum.php?mod=ajax&inajax=yes&infloat=register&handlekey=register&ajaxmenu=1&action=checkemail&email=dukertest@qq.com",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/xml",
        "Referer=http://39.105.47.72/bbs/upload/member.php?mod=register",
        "Snapshot=t16.inf",
        "Mode=HTML",
        LAST);

    web_url("forum.php_4",
        "URL=http://39.105.47.72/bbs/upload/forum.php?mod=ajax&inajax=yes&infloat=register&handlekey=register&ajaxmenu=1&action=checkemail&email=dukertest@qq.com",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/xml",
        "Referer=http://39.105.47.72/bbs/upload/member.php?mod=register",
        "Snapshot=t17.inf",
        "Mode=HTML",
        EXTRARES,
        "Url=static/js/ajax.js?Fvz", "Referer=http://39.105.47.72/bbs/upload/member.php?mod=register", ENDITEM,
        LAST);

    web_submit_data("member.php",
        "Action=http://39.105.47.72/bbs/upload/member.php?mod=register&inajax=1",
        "Method=POST",
        "EncType=multipart/form-data",
        "TargetFrame=",
        "RecContentType=text/xml",
        "Referer=http://39.105.47.72/bbs/upload/member.php?mod=register",
        "Snapshot=t18.inf",
        "Mode=HTML",
        ITEMDATA,
        "Name=regsubmit", "Value=yes", ENDITEM,
        "Name=formhash", "Value=77f1a230", ENDITEM,
        "Name=referer", "Value=forum.php", ENDITEM,
        "Name=activationauth", "Value=", ENDITEM,
        "Name=v3Dscr", "Value={username}", ENDITEM,
        "Name=YkCK4O", "Value={pwd}", ENDITEM,
        "Name=u8PxiS", "Value={repwd}", ENDITEM,
        "Name=o3DRCW", "Value={email}", ENDITEM,
        LAST);

    web_add_cookie("02rE_2132_noticeTitle=1; DOMAIN=39.105.47.72");

    web_url("forum.php_5",
        "URL=http://39.105.47.72/bbs/upload/forum.php",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://39.105.47.72/bbs/upload/member.php?mod=register",
        "Snapshot=t19.inf",
        "Mode=HTML",
        EXTRARES,
        "Url=static/js/common_extra.js?Fvz", ENDITEM,
        LAST);

    web_url("退出",
        "URL=http://39.105.47.72/bbs/upload/member.php?mod=logging&action=logout&formhash=dc9d60e7",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://39.105.47.72/bbs/upload/forum.php",
        "Snapshot=t20.inf",
        "Mode=HTML",
        LAST);

    web_url("论坛BBS",
        "URL=http://39.105.47.72/bbs/upload/forum.php",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://39.105.47.72/bbs/upload/member.php?mod=logging&action=logout&formhash=dc9d60e7",
        "Snapshot=t21.inf",
        "Mode=HTML",
        LAST);

    return 0;
}



作者: qqq911    时间: 2018-9-7 10:49
录脚本  关联   验证  压测
作者: libingyu135    时间: 2018-9-7 10:55
删除冗余代码,对注册参数进行参数化,设置循环
作者: jingzizx    时间: 2018-9-7 12:17
循环执行即可啊
作者: 梦想家    时间: 2018-9-7 14:21
循环执行
作者: cclovely    时间: 2018-9-7 16:47
对注册涉及到的参数都参数化,删除一些不必要的代码,设置循环,执行。。




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