51Testing软件测试论坛

标题: 求大神解答!!!将登录脚本剪切到vuser_init后,提示关联内容错误,详见描述 [打印本页]

作者: 妖刀    时间: 2018-5-15 19:26
标题: 求大神解答!!!将登录脚本剪切到vuser_init后,提示关联内容错误,详见描述
遇到的问题描述:录制后,对脚本做了参数化和关联,代码都在action中是能运行的,将登录的代码剪切到Vuser_init后,提示:No match found for the requested parameter "CorrelationParameter_1"
业务逻辑概述:用户登录,在列表中选择想要处理的问题,加载问题详细描述,处理问题,提交
被复制到Vuser_init中的代码
vuser_init()
{
web_url("index.shtml",
  "URL=http://172.16.0.87/pj-web/index.shtml",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Snapshot=t1.inf",
  "Mode=HTML",
  EXTRARES,
  "URL=http://www.bing.com/favicon.ico", ENDITEM,
  "URL=static-cdn/images/pad-title.png", ENDITEM,
  "URL=static-cdn/images/login/banner.jpg", ENDITEM,
  "URL=static-cdn/images/login/caption.png", ENDITEM,
  "URL=static-cdn/images/login/loc-corner.png", ENDITEM,
  "URL=static-cdn/images/login/login-icon.png", ENDITEM,
  "URL=static-cdn/component/jquery/colorbox/1.4.7.1.0/images/close.png", ENDITEM,
  "URL=http://hm.baidu.com/hm.js?ffc208e5163077c4ec683f37ce86b35b", ENDITEM,
  LAST);

web_submit_form("SystemLogin",
  "Snapshot=t2.inf",
  ITEMDATA,
  "Name=j_username", "Value={username}", ENDITEM,
  "Name=j_password", "Value=1", ENDITEM,
  EXTRARES,
  "URL=static-cdn/images/kf-monkey1.png", "Referer=http://172.16.0.87/pj-web/mark/union/union-list.shtml", ENDITEM,
  "URL=static-cdn/images/icon-help1.gif", "Referer=http://172.16.0.87/pj-web/mark/union/union-list.shtml", ENDITEM,
  "URL=static-cdn/images/pad-arrow.png", "Referer=http://172.16.0.87/pj-web/mark/union/union-list.shtml", ENDITEM,
  "URL=static-cdn/images/pad-code.png", "Referer=http://172.16.0.87/pj-web/mark/union/union-list.shtml", ENDITEM,
  LAST);
return 0;
}
保留在action中的代码
Action()
{
int count1;
int count2;

  web_url("union-list.shtml",
  "URL=http://172.16.0.87/pj-web/mark/union/union-list.shtml",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179978&optionIndex=0",
  "Snapshot=t5.inf",
  "Mode=HTML",
  LAST);

//lr_think_time(5);
for (count1 = 0;count1<2;count1++) {

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

web_reg_save_param_ex(
  "ParamName=CorrelationParameter_1",
  "LB=studentID\" value=\"",
  "RB=\" ",
  SEARCH_FILTERS,
  "Scope=Body",
  "RequestUrl=*/mark-union.shtml*",
  LAST);

web_url("mark-union.shtml",
  "URL=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179978&optionIndex=0",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Snapshot=t3.inf",
  "Mode=HTML",
  EXTRARES,
  "URL=/pj-web/static-cdn/images/mark1.png", "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179978&optionIndex=0", ENDITEM,
  "URL=/pj-web/r/30663035643433632d643535312d356236332d626136332d3536663065323566343237663a2f756e696f6e5f6e65772f313039342f312f3139332f73747564656e742f333839353637352f63646266303065666566316534366335623439623162383063646461333433312fb2a60abda1a90ec368c0.png?_=0.24283776730976814", "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179978&optionIndex=0", ENDITEM,
  "URL=/pj-web/static-cdn/component/jquery/jquery-ui/1.8.24/css/images/resize.png", "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179978&optionIndex=0", ENDITEM,
  "URL=/pj-web/static-cdn/images/mark.png", "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179978&optionIndex=0", ENDITEM,
  "URL=/pj-web/static-cdn/images/drag.png", "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179978&optionIndex=0", ENDITEM,
  "URL=/pj-web/static-cdn/component/jquery/colorbox/1.4.7.1.0/images/load.gif", "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179978&optionIndex=0", ENDITEM,
  LAST);

lr_log_message("studentid,%s",lr_eval_string("{CorrelationParameter_1}"));

web_submit_data("mark-union!ajaxSubmit.shtml",
  "Action=http://172.16.0.87/pj-web/mark/union/mark-union!ajaxSubmit.shtml",
  "Method=POST",
  "RecContentType=text/plain",
  "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179978&optionIndex=0",
  "Snapshot=t4.inf",
  "Mode=HTML",
  ITEMDATA,
  "Name=timeFlag", "Value=0", ENDITEM,
  "Name=time", "Value=0", ENDITEM,
  "Name=questionID", "Value=179978", ENDITEM,
  "Name=optionIndex", "Value=0", ENDITEM,
  "Name=flag3", "Value=0", ENDITEM,
  "Name=studentID", "Value={CorrelationParameter_1}", ENDITEM,
  "Name=choiceFlag", "Value=0", ENDITEM,
  "Name=sheetID", "Value=4378", ENDITEM,
  "Name=markTeacherType", "Value=1", ENDITEM,
  "Name=tags", "Value=", ENDITEM,
  "Name=score", "Value=2.71", ENDITEM,
  EXTRARES,
  "URL=/pj-web/r/30663035643433632d643535312d356236332d626136332d3536663065323566343237663a2f756e696f6e5f6e65772f313039342f312f3139332f73747564656e742f333839353637362f39616338386366373165383134336666616636323165373738303565666264322fb2a60abda1a90ec368c0.png?_=0.9689678548550878", "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179978&optionIndex=0", ENDITEM,
  LAST);

}

web_url("union-list.shtml",
  "URL=http://172.16.0.87/pj-web/mark/union/union-list.shtml",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179978&optionIndex=0",
  "Snapshot=t5.inf",
  "Mode=HTML",
  LAST);

for(count2 = 0;count2<2;count2++){
//Correlation comment - Do not change!Original value='3895670' Name ='CorrelationParameter_2'

web_reg_save_param_ex(
  "ParamName=CorrelationParameter_2",
  "LB=studentID\" value=\"",
  "RB=\" ",
  SEARCH_FILTERS,
  "Scope=Body",
  "RequestUrl=*/mark-union.shtml*",
  LAST);

web_url("mark-union.shtml_2",
  "URL=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179979&optionIndex=0",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Snapshot=t6.inf",
  "Mode=HTML",
  EXTRARES,
  "URL=/pj-web/r/30663035643433632d643535312d356236332d626136332d3536663065323566343237663a2f756e696f6e5f6e65772f313039342f312f3139332f73747564656e742f333839353637302f34323962623766353830636534633333386161343665356466346633313437662fb2a60abda1a90ec368c1.png?_=0.08509155479400904", "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179979&optionIndex=0", ENDITEM,
  LAST);

//lr_think_time(5);

web_submit_data("mark-union!ajaxSubmit.shtml_2",
  "Action=http://172.16.0.87/pj-web/mark/union/mark-union!ajaxSubmit.shtml",
  "Method=POST",
  "RecContentType=text/plain",
  "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179979&optionIndex=0",
  "Snapshot=t7.inf",
  "Mode=HTML",
  ITEMDATA,
  "Name=timeFlag", "Value=0", ENDITEM,
  "Name=time", "Value=0", ENDITEM,
  "Name=questionID", "Value=179979", ENDITEM,
  "Name=optionIndex", "Value=0", ENDITEM,
  "Name=flag3", "Value=0", ENDITEM,
  "Name=studentID", "Value={CorrelationParameter_2}", ENDITEM,
  "Name=choiceFlag", "Value=0", ENDITEM,
  "Name=sheetID", "Value=4378", ENDITEM,
  "Name=markTeacherType", "Value=1", ENDITEM,
  "Name=tags", "Value=", ENDITEM,
  "Name=score", "Value=2.81", ENDITEM,
  EXTRARES,
  "URL=/pj-web/r/30663035643433632d643535312d356236332d626136332d3536663065323566343237663a2f756e696f6e5f6e65772f313039342f312f3139332f73747564656e742f333839353637312f39333733323533386163316134336333623332623133313664636632356437642fb2a60abda1a90ec368c1.png?_=0.14386377759728208", "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179979&optionIndex=0", ENDITEM,
  LAST);
lr_log_message("studentid,%s",lr_eval_string("{CorrelationParameter_2}"));
}

return 0;
}

作者: 妖刀    时间: 2018-5-16 08:28
防沉,自己顶一下
作者: jhzhlc    时间: 2018-5-17 13:32
查看关联函数是否也在Vuser_init的action里面
作者: 城邦    时间: 2018-5-22 20:52
没找到检查点或者是关联函数,应该是请求有错
作者: qqq911    时间: 2018-6-26 11:58
for (count1 = 0;count1<2;count1++) {  
把for循环去掉,如果想迭代action里面的代码,在runtime-setting里面设置即可。





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