Action()
{
int Blocklist_len;
int tid_index;
//获取token
web_reg_save_param("token",
"LB=csrf_token=",
"RB=;",
"Ord=1",
"NotFound=WARNING",
LAST);
web_url("index.php",
"URL=http://localhost/phpwind/index.php",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=themes/site/default/images/main_bg.png", ENDITEM,
"Url=themes/site/default/images/common/core_bg.png", ENDITEM,
"Url=themes/site/default/images/common/style_icon.png", ENDITEM,
"Url=themes/site/default/images/forum/bg.png", ENDITEM,
"Url=res/images/face/face_small.jpg", ENDITEM,
"Url=res/js/dev/pages/common/global.js?v=20130227", ENDITEM,
"Url=res/js/dev/jquery.js?v=20130227", ENDITEM,
"Url=res/js/dev/util_libs/ajaxForm.js?v=20130227", ENDITEM,
LAST);
lr_start_transaction("login");
lr_think_time(21);
//关联status
web_reg_save_param("status",
"LB=statu=",
"RB=\"",
"Ord=1",
"NotFound=WARNING",
LAST);
web_submit_data("index.php_3",
"Action=http://localhost/phpwind/index.php?m=u&c=login&a=dologin",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost/phpwind/index.php",
"Snapshot=t2.inf",
"Mode=HTML",
ITEMDATA,
"Name=username", "Value={username}", ENDITEM,
"Name=password", "Value=123456", ENDITEM,
"Name=csrf_token", "Value={token}", ENDITEM,
"Name=csrf_token", "Value={token}", ENDITEM,
LAST);
lr_output_message("用户信息:%s",lr_eval_string("{username}"));
//检查点--登录
web_reg_find("SaveCount=findlogin",
"Text=每日打卡",
LAST);
web_url("index.php_4",
"URL=http://localhost/phpwind/index.php?m=u&c=login&a=welcome&_statu={status}",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t3.inf",
"Mode=HTML",
EXTRARES,
"Url=themes/site/default/images/common/core_icon.png", ENDITEM,
"Url=themes/site/default/images/common/loading.gif", ENDITEM,
"Url=themes/site/default/images/common/header_dorp.png", ENDITEM,
"Url=res/js/dev/util_libs/lazySlide.js?v=20130227", ENDITEM,
"Url=res/images/face/face_middle.jpg", ENDITEM,
"Url=themes/site/default/images/common/style_bg.png", ENDITEM,
"Url=res/js/dev/pages/common/sidebarMain.js?v=20130227", ENDITEM,
"Url=res/js/dev/pages/bbs/threadManage.js?v=20130227", ENDITEM,
"Url=res/js/dev/ui_libs/dialog/dialog.js?v=20130227", ENDITEM,
LAST);
//判断登录是否成功
if(atoi(lr_eval_string("{findlogin}"))>0){
lr_end_transaction("login",LR_PASS);
}else{
lr_end_transaction("login",LR_FAIL);
}
//关联板块ID
web_reg_save_param("Blocklist",
"LB=class=\"fname\"><a href=\"http://localhost/phpwind/index.php?c=thread&fid=",
"RB=\">",
"Ord=ALL",
"NotFound=WARNING",
LAST);
web_url("index.php_7",
"URL=http://localhost/phpwind/index.php?m=bbs&c=forumlist",
"Resource=0",
"RecContentType=text/html",
"Referer=http://localhost/phpwind/index.php",
"Snapshot=t7.inf",
"Mode=HTML",
EXTRARES,
"Url=themes/site/default/images/forum/old.gif", "Referer=http://localhost/phpwind/index.php?m=bbs&c=forumlist", ENDITEM,
LAST);
//对版块id进行随机数处理
Blocklist_len=lr_paramarr_len("Blocklist");
lr_output_message("%d",Blocklist_len);
srand((unsigned)time(NULL));
tid_index=rand()%Blocklist_len+1;
lr_output_message("%d",tid_index);
lr_save_string(lr_paramarr_idx("Blocklist",tid_index),"tid_tmp");
lr_output_message(lr_eval_string("{tid_tmp}"));
web_link("测试方法",
"Text=测试方法",
"Snapshot=t8.inf",
EXTRARES,
"Url=themes/site/default/images/tips/gray_big.png", "Referer=http://localhost/phpwind/index.php?c=thread&fid={tid_tmp}", ENDITEM,
LAST);
web_link("发帖",
"Text=发帖",
"Ordinal=2",
"Snapshot=t9.inf",
EXTRARES,
"Url=res/js/dev/windeditor/windeditor.js?v=20130227", "Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}", ENDITEM,
"Url=res/js/dev/windeditor/themes/buyiui/buyiui.css?v=20130227", "Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}", ENDITEM,
"Url=res/css/editor_content.css?v=", "Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}", ENDITEM,
"Url=res/js/dev/windeditor/themes/buyiui/down.png", "Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}", ENDITEM,
"Url=res/js/dev/windeditor/themes/buyiui/toolbar.png", "Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}", ENDITEM,
"Url=res/js/dev/windeditor/plugins/insertPhoto/plugin.js?v=20130227", "Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}", ENDITEM,
"Url=res/js/dev/windeditor/plugins/insertCode/plugin.js?v=20130227", "Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}", ENDITEM,
"Url=res/js/dev/windeditor/plugins/insertEmoticons/plugin.js?v=20130227", "Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}", ENDITEM,
"Url=res/js/dev/windeditor/plugins/insertFile/plugin.js?v=20130227", "Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}", ENDITEM,
"Url=res/js/dev/windeditor/plugins/openApp/plugin.js?v=20130227", "Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}", ENDITEM,
"Url=res/js/dev/windeditor/plugins/bbcode/plugin.js?v=20130227", "Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}", ENDITEM,
"Url=res/js/dev/windeditor/plugins/insertCode/syntaxHihglighter/styles/shCoreDefault.css?v=20130227", "Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}", ENDITEM,
LAST);
web_url("index.php_8",
"URL=http://localhost/phpwind/index.php?m=emotion&type=bbs&csrf_token={token}&_=1533290618953",
"Resource=0",
"RecContentType=text/html",
"Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}",
"Snapshot=t10.inf",
"Mode=HTML",
LAST);
lr_think_time(14);
//关联发帖的帖子和版块的ID
web_reg_save_param("looktiezi",
"LB=/read.php?",
"RB=\"",
"Ord=1",
"NotFound=WARNING",
LAST);
//发帖开始事务
lr_start_transaction("post_tiezi");
web_submit_data("index.php_9",
"Action=http://localhost/phpwind/index.php?c=post&a=doadd&_json=1&fid={tid_tmp}",
"Method=POST",
"EncType=multipart/form-data",
"RecContentType=text/html",
"Referer=http://localhost/phpwind/index.php?c=post&fid={tid_tmp}",
"Snapshot=t12.inf",
"Mode=HTML",
ITEMDATA,
"Name=atc_title", "Value={username}于{fatie_param}发的帖子", ENDITEM,
"Name=atc_content", "Value={username}于{fatie_param}发的帖子内容", ENDITEM,
"Name=pid", "Value=", ENDITEM,
"Name=tid", "Value=", ENDITEM,
"Name=special", "Value=default", ENDITEM,
"Name=reply_notice", "Value=1", ENDITEM,
"Name=csrf_token", "Value={token}", ENDITEM,
LAST);
//检查点-检查帖子是否发帖成功
web_reg_find("Search=All",
"SaveCount=chek_post",
"Text=发帖数",
LAST);
web_url("read.php",
"URL=http://localhost/phpwind/read.php?{looktiezi}",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t13.inf",
"Mode=HTML",
EXTRARES,
"Url=res/js/dev/pages/common/userTag.js?v=20130227", "Referer=http://localhost/phpwind/read.php?{looktiezi}", ENDITEM,
"Url=res/js/dev/pages/common/likePlus.js?v=20130227", "Referer=http://localhost/phpwind/read.php?{looktiezi}", ENDITEM,
"Url=res/js/dev/pages/common/insertEmotions.js?v=20130227", "Referer=http://localhost/phpwind/read.php?{looktiezi}", ENDITEM,
"Url=res/js/dev/pages/common/report.js?v=20130227", "Referer=http://localhost/phpwind/read.php?{looktiezi}", ENDITEM,
"Url=res/js/dev/pages/common/sendMsgPop.js?v=20130227", "Referer=http://localhost/phpwind/read.php?{looktiezi}", ENDITEM,
LAST);
//查看帖子是否发帖成功,结束事务
if(atoi(lr_eval_string("{chek_post}"))>0){
lr_end_transaction("post_tiezi",LR_PASS);
}else{
lr_end_transaction("post_tiezi",LR_FAIL);
}
web_submit_data("index.php_10",
"Action=http://localhost/phpwind/index.php?m=u&a=showcredit",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost/phpwind/read.php?{looktiezi}",
"Snapshot=t14.inf",
"Mode=HTML",
ITEMDATA,
"Name=csrf_token", "Value={token}", ENDITEM,
EXTRARES,
"Url=res/js/dev/pages/bbs/read.js?v=20130227", "Referer=http://localhost/phpwind/read.php?{looktiezi}", ENDITEM,
"Url=res/js/dev/util_libs/localStorage.js?v=20130227", "Referer=http://localhost/phpwind/read.php?{looktiezi}", ENDITEM,
"Url=res/js/dev/util_libs/textCopy/textCopy.js?v=20130227", "Referer=http://localhost/phpwind/read.php?{looktiezi}", ENDITEM,
LAST);
return 0;
}
LoadRunner:phpwind脚本练习之版块随机发帖
猜你喜欢
转载自blog.csdn.net/qq_24644517/article/details/81436566
今日推荐
周排行