说明

1.用户登录部分,用户名和密码我已经实现参数化了
2.用户登录成功之后,点击【我要报名】,点击【同意以下协议并报名】,进入选择课程页面,每个用户可以自由选择多种课程,选择好之后【保存班级】,主要就是做这一部分的压力测试
3.以下是我录制的脚本,请各位大神帮忙看看,哪些地方该设置参数化和关联
4.脚本需要做哪些修改

脚本顺序

脚本

1.登录脚本

ActionDL()
{

    web_set_max_html_param_len("1024");

    web_url("picinfo.ini",
        "URL=http://se.360.cn/cloud/picinfo.ini",
        "TargetFrame=",
        "Resource=1",
        "RecContentType=application/octet-stream",
        "Referer=",
        "Snapshot=t1.inf",
        LAST);

//  web_add_cookie("CNZZDATA1254046670=1710710057-1491368334-%7C1491368334; DOMAIN=test.lndxpt.com");

//  web_add_cookie("UM_distinctid=15b3ca07cf7e7d-0106a39880d561-6d247a13-15f900-15b3ca07cf8deb; DOMAIN=test.lndxpt.com");

/* Registering parameter(s) from source task id 7
    // {JSESSIONID3} = "jrt39txdore6"
    // */

    web_reg_save_param("JSESSIONID3",
        "LB/IC=jsessionid=",
        "RB/IC=\"",
        "Ord=1",
        "RelFrameId=1",
        "Search=body",
        LAST);

    web_url("lndxreg!toReg.do",
        "URL=http://test.lndxpt.com/lndx1/lndxreg!toReg.do?compCode=tjlndx",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=",
        "Snapshot=t2.inf",
        "Mode=HTML",
        EXTRARES,
        "URL=images/bg.png", "Referer=http://test.lndxpt.com/lndx1/lndxreg!toReg.do?compCode=tjlndx", ENDITEM,
        "URL=images/icon_x.png", "Referer=http://test.lndxpt.com/lndx1/lndxreg!toReg.do?compCode=tjlndx", ENDITEM,
        "URL=http://c.cnzz.com/core.php?web_id=1254046670&t=z", "Referer=http://test.lndxpt.com/lndx1/lndxreg!toReg.do?compCode=tjlndx", ENDITEM,
        "URL=http://z11.cnzz.com/stat.htm?id=1254046670&r=&lg=zh-cn&ntime=none&cnzz_eid=1710710057-1491368334-&showp=1600x900&t=%E5%A4%A9%E6%B4%A5%E5%B8%82%E8%80%81%E5%B9%B4%E4%BA%BA%E5%A4%A7%E5%AD%A6&umuuid=15b3ca07cf7e7d-0106a39880d561-6d247a13-15f900-15b3ca07cf8deb&h=1&rnd=1054212925", "Referer=http://test.lndxpt.com/lndx1/lndxreg!toReg.do?compCode=tjlndx", ENDITEM,
        LAST);

    lr_think_time(17);


    lr_start_transaction("登录");

    lr_rendezvous("登录");
    web_reg_save_param("sid",
        "LB=<a href=\"lndxreg!toleave.do?compCode=tjlndx&sid=",
        "RB=\">我要请假",
        "Ord=1",
        "RelFrameId=1",
        LAST);

    web_reg_save_param("sessionloginkey",
        "LB=sessionloginkey=",
        "RB=\">回首页</a>",
        "Ord=1",
        "RelFrameId=1",
        LAST);

    web_submit_data("lndxreg!checkCard.do;jsessionid=jrt39txdore6",
        "Action=http://test.lndxpt.com/lndx1/lndxreg!checkCard.do;jsessionid={JSESSIONID3}",
        "Method=POST",
        "TargetFrame=",
        "RecContentType=text/html",
        "Referer=http://test.lndxpt.com/lndx1/lndxreg!toReg.do?compCode=tjlndx",
        "Snapshot=t3.inf",
        "Mode=HTML",
        ITEMDATA,
        "Name=sname", "Value={SNAME}", ENDITEM,
        "Name=idCard", "Value={IDCARD}", ENDITEM,
        "Name=schoolname", "Value=天津市老年人大学", ENDITEM,
        "Name=compCode", "Value=tjlndx", ENDITEM,
        "Name=log", "Value=", ENDITEM,
        EXTRARES,
        "URL=images/nav_icon.png", ENDITEM,
        "URL=http://z11.cnzz.com/stat.htm?id=1254046670&r=http%3A%2F%2Ftest.lndxpt.com%2Flndx1%2Flndxreg!toReg.do%3FcompCode%3Dtjlndx&lg=zh-cn&ntime=1491368334&cnzz_eid=1710710057-1491368334-&showp=1600x900&t=%E5%A4%A9%E6%B4%A5%E5%B8%82%E8%80%81%E5%B9%B4%E4%BA%BA%E5%A4%A7%E5%AD%A6&umuuid=15b3ca07cf7e7d-0106a39880d561-6d247a13-15f900-15b3ca07cf8deb&h=1&rnd=518854306", ENDITEM,
        LAST);

    lr_end_transaction("登录", LR_AUTO);

    //lr_output_message("username = %s,idCard = %s", lr_eval_string("{SNAME}"), lr_eval_string("{IDCARD}"));

return 0;
}

2.登录成功之后,我要报名脚本

ActionWYBM()
{
    lr_think_time(19);

    web_url("lndxreg!login.do",
        "URL=http://test.lndxpt.com/lndx1/lndxreg!login.do?compCode=tjlndx&sid={sid}&sessionloginkey={sessionloginkey}",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://test.lndxpt.com/lndx1/lndxreg!checkCard.do;jsessionid={JSESSIONID3}",
        "Snapshot=t4.inf",
        "Mode=HTML",
        EXTRARES,
        "URL=http://z11.cnzz.com/stat.htm?id=1254046670&r=http%3A%2F%2Ftest.lndxpt.com%2Flndx1%2Flndxreg!checkCard.do%3Bjsessionid%3D{JSESSIONID3}&lg=zh-cn&ntime=1491368334&cnzz_eid=1710710057-1491368334-&showp=1600x900&t=%E5%A4%A9%E6%B4%A5%E5%B8%82%E8%80%81%E5%B9%B4%E4%BA%BA%E5%A4%A7%E5%AD%A6&umuuid=15b3ca07cf7e7d-0106a39880d561-6d247a13-15f900-15b3ca07cf8deb&h=1&rnd=543153531", "Referer=http://test.lndxpt.com/lndx1/lndxreg!login.do?compCode=tjlndx&sid={sid}&sessionloginkey={sessionloginkey}", ENDITEM,
        LAST);

    lr_output_message("username = %s,idCard = %s", lr_eval_string("{SNAME}"), lr_eval_string("{IDCARD}"));


    lr_think_time(31);


    lr_start_transaction("同意协议");

    lr_rendezvous("同意协议");

    web_submit_data("lndxreg!tonet.do",
        "Action=http://test.lndxpt.com/lndx1/lndxreg!tonet.do",
        "Method=POST",
        "TargetFrame=",
        "RecContentType=text/html",
        "Referer=http://test.lndxpt.com/lndx1/lndxreg!login.do?compCode=tjlndx&sid=3020002&sessionloginkey=1491370819744-3355",
        "Snapshot=t5.inf",
        "Mode=HTML",
        ITEMDATA,
        "Name=Submit", "Value=同意以下协议并报名", ENDITEM,
        "Name=schoolname", "Value=天津市老年人大学", ENDITEM,
        "Name=sessionloginkey", "Value={sessionloginkey}", ENDITEM,
        "Name=compCode", "Value=tjlndx", ENDITEM,
        "Name=log", "Value=", ENDITEM,
        "Name=sid", "Value={sid}", ENDITEM,
        EXTRARES,
        "URL=images/search_b.png", ENDITEM,
        "URL=images/fenye_nav.gif", ENDITEM,
        "URL=images/jia.gif", ENDITEM,
        "URL=http://z11.cnzz.com/stat.htm?id=1254046670&r=http%3A%2F%2Ftest.lndxpt.com%2Flndx1%2Flndxreg!login.do%3FcompCode%3Dtjlndx%26sid%3D{sid}%26sessionloginkey%3D{sessionloginkey}&lg=zh-cn&ntime=1491368334&cnzz_eid=1710710057-1491368334-&showp=1600x900&t=%E5%A4%A9%E6%B4%A5%E5%B8%82%E8%80%81%E5%B9%B4%E4%BA%BA%E5%A4%A7%E5%AD%A6&umuuid=15b3ca07cf7e7d-0106a39880d561-6d247a13-15f900-15b3ca07cf8deb&h=1&rnd=2067943120", ENDITEM,
        LAST);



    lr_end_transaction("同意协议", LR_AUTO);

return 0;
}

3.同意协议之后,选择报名班级的脚本

ActionXZBMBJ()
{

    lr_think_time(37);

    web_url("sc.png", 
        "URL=http://test.lndxpt.com/lndx1/images/sc.png", 
        "TargetFrame=", 
        "Resource=1", 
        "RecContentType=image/png", 
        "Referer=http://test.lndxpt.com/lndx1/lndxreg!tonet.do", 
        "Snapshot=t6.inf", 
        LAST);

    web_url("lndxreg!findclass.do", 
        "URL=http://test.lndxpt.com/lndx1/lndxreg!findclass.do?compCode=tjlndx&sid={sid}&scnamelike=&week=&organid=1020002&courseId=11020002&page=1", 
        "TargetFrame=", 
        "Resource=1", 
        "RecContentType=html/text", 
        "Referer=http://test.lndxpt.com/lndx1/lndxreg!tonet.do", 
        "Snapshot=t7.inf", 
        LAST);

    web_url("lndxreg!verifySelectClass.do", 
        "URL=http://test.lndxpt.com/lndx1/lndxreg!verifySelectClass.do?sid={sid}&termid=3020004&sclass=&sclid=1465020012", 
        "TargetFrame=", 
        "Resource=1", 
        "RecContentType=html/text", 
        "Referer=http://test.lndxpt.com/lndx1/lndxreg!tonet.do", 
        "Snapshot=t8.inf", 
        LAST);

    web_url("lndxreg!verifySelectClass.do_2", 
        "URL=http://test.lndxpt.com/lndx1/lndxreg!verifySelectClass.do?sid={sid}&termid=3020004&sclass=1465020012,&sclid=1465020013", 
        "TargetFrame=", 
        "Resource=1", 
        "RecContentType=html/text", 
        "Referer=http://test.lndxpt.com/lndx1/lndxreg!tonet.do", 
        "Snapshot=t9.inf", 
        LAST);

    web_url("lndxreg!verifySelectClass.do_3", 
        "URL=http://test.lndxpt.com/lndx1/lndxreg!verifySelectClass.do?sid={sid}&termid=3020004&sclass=1465020012,1465020013,&sclid=1465020014", 
        "TargetFrame=", 
        "Resource=1", 
        "RecContentType=html/text",

        "Referer=http://test.lndxpt.com/lndx1/lndxreg!tonet.do", 
        "Snapshot=t10.inf", 
        LAST);

    return 0;
}

4.提交报名班级的脚本

ActionBCBJ()
{

    lr_think_time(15);

    lr_start_transaction("保存报名");

    lr_rendezvous("保存报名");



    web_submit_data("lndxreg!checkSc.do", 
        "Action=http://test.lndxpt.com/lndx1/lndxreg!checkSc.do", 
        "Method=POST", 
        "TargetFrame=", 
        "RecContentType=text/html", 
        "Referer=http://test.lndxpt.com/lndx1/lndxreg!tonet.do", 
        "Snapshot=t11.inf", 
        "Mode=HTML", 
        ITEMDATA, 
        "Name=scnamelike", "Value=", ENDITEM, 
        "Name=schoolname", "Value=天津市老年人大学", ENDITEM, 
        "Name=compCode", "Value=tjlndx", ENDITEM, 
        "Name=sid", "Value={sid}", ENDITEM, 
        "Name=sessionloginkey", "Value={sessionloginkey}", ENDITEM, 
        "Name=log", "Value=", ENDITEM, 
        "Name=sclass", "Value=1465020012,1465020013,1465020014,", ENDITEM, 
        "Name=termid", "Value=3020004", ENDITEM, 
        "Name=courseid", "Value=11020002", ENDITEM, 
        "Name=week", "Value=", ENDITEM, 
        "Name=organid", "Value=1020002", ENDITEM, 
        "Name=page", "Value=1", ENDITEM, 
        "Name=topage", "Value=2", ENDITEM, 
        EXTRARES, 
        "Url=http://z11.cnzz.com/stat.htm?id=1254046670&r=http%3A%2F%2Ftest.lndxpt.com%2Flndx1%2Flndxreg!tonet.do&lg=zh-cn&ntime=1491368334&cnzz_eid=1710710057-1491368334-&showp=1600x900&t=%E5%A4%A9%E6%B4%A5%E5%B8%82%E8%80%81%E5%B9%B4%E4%BA%BA%E5%A4%A7%E5%AD%A6&umuuid=15b3ca07cf7e7d-0106a39880d561-6d247a13-15f900-15b3ca07cf8deb&h=1&rnd=696609092", ENDITEM, 
        LAST);

    web_url("lndxreg!checkwait.do", 
        "URL=http://test.lndxpt.com/lndx1/lndxreg!checkwait.do?compCode=tjlndx&sid={sid}&sessionloginkey={sessionloginkey}", 
        "TargetFrame=", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=http://test.lndxpt.com/lndx1/lndxreg!checkSc.do", 
        "Snapshot=t12.inf", 
        "Mode=HTML", 
        EXTRARES, 
        "Url=http://z11.cnzz.com/stat.htm?id=1254046670&r=http%3A%2F%2Ftest.lndxpt.com%2Flndx1%2Flndxreg!checkSc.do&lg=zh-cn&ntime=1491368334&cnzz_eid=1710710057-1491368334-&showp=1600x900&t=&umuuid=15b3ca07cf7e7d-0106a39880d561-6d247a13-15f900-15b3ca07cf8deb&h=1&rnd=1916364215", "Referer=http://test.lndxpt.com/lndx1/lndxreg!checkwait.do?compCode=tjlndx&sid={sid}&sessionloginkey={sessionloginkey}", ENDITEM, 
        LAST);

    lr_end_transaction("保存报名", LR_AUTO);

    return 0;
}


↙↙↙阅读原文可查看相关链接,并与作者交流