star_xing815 发表于 2013-7-20 14:32:45

loadrunner录制discuz 注册功能,回放脚本虽没有错误,但没有注册成功,请帮忙!

Action()
{

        web_add_cookie("sNMy_2132_lastact=1374301525%09forum.php%09; DOMAIN=127.0.0.1");

        web_url("forum.php",
                "URL=http://127.0.0.1/forum.php",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=/static/image/common/background.png", ENDITEM,
                "Url=/static/image/common/px.png", ENDITEM,
                "Url=/static/image/common/newarow.gif", ENDITEM,
                "Url=/static/image/common/pn.png", ENDITEM,
                "Url=/static/image/common/nv.png", ENDITEM,
                "Url=/static/image/common/qmenu.png", ENDITEM,
                "Url=/static/image/common/nv_a.png", ENDITEM,
                "Url=/static/image/common/pt_item.png", ENDITEM,
                "Url=/static/image/common/chart.png", ENDITEM,
                "Url=/static/image/common/switch_width.png", ENDITEM,
                "Url=/static/image/common/titlebg.png", ENDITEM,
                "Url=/static/image/common/scrolltop.png", ENDITEM,
                "Url=/static/image/common/search.png", ENDITEM,
                "Url=/favicon.ico", "Referer=", ENDITEM,
                LAST);

        lr_start_transaction("reg");

        lr_think_time(16);

        web_url("?",
                "URL=http://127.0.0.1/member.php?mod=register",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://127.0.0.1/forum.php",
                "Snapshot=t2.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=/static/image/common/right.gif", "Referer=http://127.0.0.1/member.php?mod=register", ENDITEM,
                LAST);

        lr_think_time(8);

        web_url("forum.php_2",
                "URL=http://127.0.0.1/forum.php?mod=ajax&inajax=yes&infloat=register&handlekey=register&ajaxmenu=1&action=checkusername&username=test21",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/xml",
                "Referer=http://127.0.0.1/member.php?mod=register",
                "Snapshot=t3.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=/static/image/common/check_right.gif", "Referer=http://127.0.0.1/member.php?mod=register", ENDITEM,
                "Url=/static/image/common/passlevel.png", "Referer=http://127.0.0.1/member.php?mod=register", ENDITEM,
                LAST);

        lr_think_time(21);

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

        lr_think_time(7);

        web_submit_data("member.php",
                "Action=http://127.0.0.1/member.php?mod=register&inajax=1",
                "Method=POST",
                "EncType=multipart/form-data",
                "TargetFrame=",
                "RecContentType=text/xml",
                "Referer=http://127.0.0.1/member.php?mod=register",
                "Snapshot=t5.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=regsubmit", "Value=yes", ENDITEM,
                "Name=formhash", "Value=69b96c90", ENDITEM,
                "Name=referer", "Value=http://127.0.0.1/forum.php", ENDITEM,
                "Name=activationauth", "Value=", ENDITEM,
                "Name=mcXXZK", "Value={username}", ENDITEM,
                "Name=B998Ll", "Value=test", ENDITEM,
                "Name=LsnzBk", "Value=test", ENDITEM,
                "Name=Z3Yywq", "Value={username}@qq.com", ENDITEM,
                LAST);

        web_add_cookie("sNMy_2132_lastact=1374301584%09forum.php%09; DOMAIN=127.0.0.1");

        web_add_cookie("sNMy_2132_noticeTitle=1; DOMAIN=127.0.0.1");

        web_url("forum.php_4",
                "URL=http://127.0.0.1/forum.php",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t6.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=/static/image/common/notice.gif", ENDITEM,
                "Url=/static/image/common/switch_style.png", ENDITEM,
                "Url=/static/image/common/user_online.gif", ENDITEM,
                "Url=/static/image/common/arrwd.gif", ENDITEM,
                "Url=/static/image/common/ico_notice.png", ENDITEM,
                "Url=/static/image/feed/favorite_b.png", ENDITEM,
                "Url=/static/image/feed/thread_b.png", ENDITEM,
                "Url=/static/image/feed/magic_b.png", ENDITEM,
                "Url=/static/image/feed/medal_b.png", ENDITEM,
                "Url=/static/image/feed/task_b.png", ENDITEM,
                "Url=/static/image/common/close.gif", ENDITEM,
                "Url=/static/image/feed/friend_b.png", ENDITEM,
                "Url=/static/js/common_extra.js?i1Q", ENDITEM,
                "Url=/static/image/common/popupcredit_bg.gif", ENDITEM,
                "Url=http://cp.discuz.qq.com/tips/get?rand=2014&s_id=&product_version=X3&product_release=&fix_bug=&is_founder=&s_url=http%3A%2F%2F127.0.0.1%2F&last_send_time=&ts=1374301584&sig=&admin_id=0&group_id=10&open_id=&uid=26&callback=discuzTipsCallback", ENDITEM,
                LAST);

        lr_end_transaction("reg",LR_AUTO);

        return 0;
}

张亚洲 发表于 2013-7-22 08:28:00

"Name=formhash", "Value=69b96c90", ENDITEM,
69b96c90这个需要关联的,formhash是加密的。
再一个就是你设置参数化取值方式也很重要。
加一个登录成功标志的检查点。应该就没问题了。

star_xing815 发表于 2013-7-22 11:14:44

脚本的这处关联我也看到了,用了系统自动关联找到的,但是,关联后,还是运行失败,超级郁闷中。。。。。

star_xing815 发表于 2013-7-22 11:36:15

脚本关联后,回放没有错误,但是,还是不成功。查看结果如图所示

star_xing815 发表于 2013-7-22 11:39:39

Action()
{

        web_add_cookie("sNMy_2132_lastact=1374463130%09forum.php%09; DOMAIN=127.0.0.1");

//Correlation comment - Do not change!Original value='86233623' Name ='CorrelationParameter_1'

        web_reg_save_param_ex(
                "ParamName=CorrelationParameter_1",
                "LB= value=\"",
                "RB=\" ",
                SEARCH_FILTERS,
                "Scope=Body",
                "RequestUrl=*/forum.php*",
                LAST);

        web_url("forum.php",
                "URL=http://127.0.0.1/forum.php",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                EXTRARES,
                "URL=/static/image/common/newarow.gif", ENDITEM,
                "URL=/static/image/common/px.png", ENDITEM,
                "URL=/static/image/common/pn.png", ENDITEM,
                "URL=/static/image/common/background.png", ENDITEM,
                "URL=/static/image/common/nv.png", ENDITEM,
                "URL=/static/image/common/qmenu.png", ENDITEM,
                "URL=/static/image/common/switch_width.png", ENDITEM,
                "URL=/static/image/common/pt_item.png", ENDITEM,
                "URL=/static/image/common/chart.png", ENDITEM,
                "URL=/static/image/common/nv_a.png", ENDITEM,
                "URL=/static/image/common/titlebg.png", ENDITEM,
                "URL=/static/image/common/search.png", ENDITEM,
                "URL=/static/image/common/scrolltop.png", ENDITEM,
                "URL=/favicon.ico", ENDITEM,
                LAST);

        lr_start_transaction("注册");

        lr_think_time(18);

        web_url("?",
                "URL=http://127.0.0.1/member.php?mod=register",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://127.0.0.1/forum.php",
                "Snapshot=t2.inf",
                "Mode=HTML",
                EXTRARES,
                "URL=/static/image/common/right.gif", "Referer=http://127.0.0.1/member.php?mod=register", ENDITEM,
                LAST);

        lr_think_time(4);

        web_url("forum.php_2",
                "URL=http://127.0.0.1/forum.php?mod=ajax&inajax=yes&infloat=register&handlekey=register&ajaxmenu=1&action=checkusername&username=test23",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/xml",
                "Referer=http://127.0.0.1/member.php?mod=register",
                "Snapshot=t3.inf",
                "Mode=HTML",
                EXTRARES,
                "URL=/static/image/common/check_right.gif", "Referer=http://127.0.0.1/member.php?mod=register", ENDITEM,
                "URL=/static/image/common/passlevel.png", "Referer=http://127.0.0.1/member.php?mod=register", ENDITEM,
                "URL=/static/image/common/px_e.png", "Referer=http://127.0.0.1/member.php?mod=register", ENDITEM,
                LAST);

        lr_think_time(12);

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

        web_add_cookie("sNMy_2132_lastact=1374463156%09forum.php%09ajax; DOMAIN=127.0.0.1");

        web_submit_data("member.php",
                "Action=http://127.0.0.1/member.php?mod=register&inajax=1",
                "Method=POST",
                "EncType=multipart/form-data",
                "TargetFrame=",
                "RecContentType=text/xml",
                "Referer=http://127.0.0.1/member.php?mod=register",
                "Snapshot=t5.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=regsubmit", "Value=yes", ENDITEM,
                "Name=formhash", "Value={CorrelationParameter_1}", ENDITEM,
                "Name=referer", "Value=http://127.0.0.1/forum.php", ENDITEM,
                "Name=activationauth", "Value=", ENDITEM,
                "Name=mcXXZK", "Value=test23", ENDITEM,
                "Name=B998Ll", "Value=test", ENDITEM,
                "Name=LsnzBk", "Value=test", ENDITEM,
                "Name=Z3Yywq", "Value=test23@qq.com", ENDITEM,
                LAST);

        web_add_cookie("sNMy_2132_noticeTitle=1; DOMAIN=127.0.0.1");

        web_url("forum.php_4",
                "URL=http://127.0.0.1/forum.php",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t6.inf",
                "Mode=HTML",
                EXTRARES,
                "URL=/static/image/common/notice.gif", ENDITEM,
                "URL=/static/image/common/switch_style.png", ENDITEM,
                "URL=/static/image/common/user_online.gif", ENDITEM,
                "URL=/static/image/common/ico_notice.png", ENDITEM,
                "URL=/static/image/common/arrwd.gif", ENDITEM,
                "URL=/static/image/common/close.gif", ENDITEM,
                "URL=/static/image/feed/favorite_b.png", ENDITEM,
                "URL=/static/image/feed/magic_b.png", ENDITEM,
                "URL=/static/image/feed/medal_b.png", ENDITEM,
                "URL=/static/image/feed/task_b.png", ENDITEM,
                "URL=/static/image/feed/friend_b.png", ENDITEM,
                "URL=/static/image/feed/thread_b.png", ENDITEM,
                "URL=/static/js/common_extra.js?i1Q", ENDITEM,
                "URL=/static/image/common/popupcredit_bg.gif", ENDITEM,
                "URL=http://cp.discuz.qq.com/tips/get?rand=2211&s_id=&product_version=X3&product_release=&fix_bug=&is_founder=&s_url=http%3A%2F%2F127.0.0.1%2F&last_send_time=&ts=1374463177&sig=&admin_id=0&group_id=10&open_id=&uid=27&callback=discuzTipsCallback", ENDITEM,
                LAST);

        lr_end_transaction("注册", LR_AUTO);

return 0;
}
这个是关联后的脚本

张亚洲 发表于 2013-7-23 08:17:59

参数化的取值方式呢?
用户名、密码和邮箱为啥没参数化呢???

张亚洲 发表于 2013-7-23 08:19:13

注册取值一个数据只能取一次。获取参数的规则很重要。

star_xing815 发表于 2013-7-23 15:43:22

参数化过,但是,也是同样的结果,运行没有错误,但是就是没有注册成功。如果最简单的方式,回放脚本都不成功,我想即使参数化也同样会失败,我搞不懂的就是,脚本中需要修改的地方都改过了,但是,还是不能运行这样一个简单的脚本,让人很郁闷。。。
页: [1]
查看完整版本: loadrunner录制discuz 注册功能,回放脚本虽没有错误,但没有注册成功,请帮忙!