51Testing软件测试论坛

标题: Day5-2测试积点任务 [打印本页]

作者: lsekfe    时间: 2018-5-17 13:29
标题: Day5-2测试积点任务
问题:求大神解答!!!将登录脚本剪切到vuser_init后,提示关联内容错误,详见描述
遇到的问题描述:录制后,对脚本做了参数化和关联,代码都在action中是能运行的,将登录的代码剪切到Vuser_init后,提示:No match found for the requested parameter "CorrelationParameter_1"
业务逻辑概述:用户登录,在列表中选择想要处理的问题,加载问题详细描述,处理问题,提交
被复制到Vuser_init中的代码


  1. vuser_init()
  2. {
  3. web_url("index.shtml",
  4.   "URL=http://172.16.0.87/pj-web/index.shtml",
  5.   "Resource=0",
  6.   "RecContentType=text/html",
  7.   "Referer=",
  8.   "Snapshot=t1.inf",
  9.   "Mode=HTML",
  10.   EXTRARES,
  11.   "URL=http://www.bing.com/favicon.ico", ENDITEM,
  12.   "URL=static-cdn/images/pad-title.png", ENDITEM,
  13.   "URL=static-cdn/images/login/banner.jpg", ENDITEM,
  14.   "URL=static-cdn/images/login/caption.png", ENDITEM,
  15.   "URL=static-cdn/images/login/loc-corner.png", ENDITEM,
  16.   "URL=static-cdn/images/login/login-icon.png", ENDITEM,
  17.   "URL=static-cdn/component/jquery/colorbox/1.4.7.1.0/images/close.png", ENDITEM,
  18.   "URL=http://hm.baidu.com/hm.js?ffc208e5163077c4ec683f37ce86b35b", ENDITEM,
  19.   LAST);

  20. web_submit_form("SystemLogin",
  21.   "Snapshot=t2.inf",
  22.   ITEMDATA,
  23.   "Name=j_username", "Value={username}", ENDITEM,
  24.   "Name=j_password", "Value=1", ENDITEM,
  25.   EXTRARES,
  26.   "URL=static-cdn/images/kf-monkey1.png", "Referer=http://172.16.0.87/pj-web/mark/union/union-list.shtml", ENDITEM,
  27.   "URL=static-cdn/images/icon-help1.gif", "Referer=http://172.16.0.87/pj-web/mark/union/union-list.shtml", ENDITEM,
  28.   "URL=static-cdn/images/pad-arrow.png", "Referer=http://172.16.0.87/pj-web/mark/union/union-list.shtml", ENDITEM,
  29.   "URL=static-cdn/images/pad-code.png", "Referer=http://172.16.0.87/pj-web/mark/union/union-list.shtml", ENDITEM,
  30.   LAST);
  31. return 0;
  32. }
  33. 保留在action中的代码
  34. Action()
  35. {
  36. int count1;
  37. int count2;

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

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

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

  49. web_reg_save_param_ex(
  50.   "ParamName=CorrelationParameter_1",
  51.   "LB=studentID\" value=\"",
  52.   "RB=\" ",
  53.   SEARCH_FILTERS,
  54.   "Scope=Body",
  55.   "RequestUrl=*/mark-union.shtml*",
  56.   LAST);

  57. web_url("mark-union.shtml",
  58.   "URL=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179978&optionIndex=0",
  59.   "Resource=0",
  60.   "RecContentType=text/html",
  61.   "Referer=",
  62.   "Snapshot=t3.inf",
  63.   "Mode=HTML",
  64.   EXTRARES,
  65.   "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,
  66.   "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,
  67.   "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,
  68.   "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,
  69.   "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,
  70.   "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,
  71.   LAST);

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

  73. web_submit_data("mark-union!ajaxSubmit.shtml",
  74.   "Action=http://172.16.0.87/pj-web/mark/union/mark-union!ajaxSubmit.shtml",
  75.   "Method=POST",
  76.   "RecContentType=text/plain",
  77.   "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179978&optionIndex=0",
  78.   "Snapshot=t4.inf",
  79.   "Mode=HTML",
  80.   ITEMDATA,
  81.   "Name=timeFlag", "Value=0", ENDITEM,
  82.   "Name=time", "Value=0", ENDITEM,
  83.   "Name=questionID", "Value=179978", ENDITEM,
  84.   "Name=optionIndex", "Value=0", ENDITEM,
  85.   "Name=flag3", "Value=0", ENDITEM,
  86.   "Name=studentID", "Value={CorrelationParameter_1}", ENDITEM,
  87.   "Name=choiceFlag", "Value=0", ENDITEM,
  88.   "Name=sheetID", "Value=4378", ENDITEM,
  89.   "Name=markTeacherType", "Value=1", ENDITEM,
  90.   "Name=tags", "Value=", ENDITEM,
  91.   "Name=score", "Value=2.71", ENDITEM,
  92.   EXTRARES,
  93.   "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,
  94.   LAST);

  95. }

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

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

  106. web_reg_save_param_ex(
  107.   "ParamName=CorrelationParameter_2",
  108.   "LB=studentID\" value=\"",
  109.   "RB=\" ",
  110.   SEARCH_FILTERS,
  111.   "Scope=Body",
  112.   "RequestUrl=*/mark-union.shtml*",
  113.   LAST);

  114. web_url("mark-union.shtml_2",
  115.   "URL=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179979&optionIndex=0",
  116.   "Resource=0",
  117.   "RecContentType=text/html",
  118.   "Referer=",
  119.   "Snapshot=t6.inf",
  120.   "Mode=HTML",
  121.   EXTRARES,
  122.   "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,
  123.   LAST);

  124. //lr_think_time(5);

  125. web_submit_data("mark-union!ajaxSubmit.shtml_2",
  126.   "Action=http://172.16.0.87/pj-web/mark/union/mark-union!ajaxSubmit.shtml",
  127.   "Method=POST",
  128.   "RecContentType=text/plain",
  129.   "Referer=http://172.16.0.87/pj-web/mark/union/mark-union.shtml?questionID=179979&optionIndex=0",
  130.   "Snapshot=t7.inf",
  131.   "Mode=HTML",
  132.   ITEMDATA,
  133.   "Name=timeFlag", "Value=0", ENDITEM,
  134.   "Name=time", "Value=0", ENDITEM,
  135.   "Name=questionID", "Value=179979", ENDITEM,
  136.   "Name=optionIndex", "Value=0", ENDITEM,
  137.   "Name=flag3", "Value=0", ENDITEM,
  138.   "Name=studentID", "Value={CorrelationParameter_2}", ENDITEM,
  139.   "Name=choiceFlag", "Value=0", ENDITEM,
  140.   "Name=sheetID", "Value=4378", ENDITEM,
  141.   "Name=markTeacherType", "Value=1", ENDITEM,
  142.   "Name=tags", "Value=", ENDITEM,
  143.   "Name=score", "Value=2.81", ENDITEM,
  144.   EXTRARES,
  145.   "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,
  146.   LAST);
  147. lr_log_message("studentid,%s",lr_eval_string("{CorrelationParameter_2}"));
  148. }

  149. return 0;
  150. }
复制代码




作者: 海海豚    时间: 2018-5-18 09:19
查看关联函数是否也在Vuser_init的action里面
作者: abcsell    时间: 2018-5-18 09:35
查看关联函数是否也在Vuser_init的action里面
作者: 梦想家    时间: 2018-5-18 09:59
查看关联函数是否也在Vuser_init的action里面
作者: jingzizx    时间: 2018-5-18 10:17
脚本的作用域移过去
作者: libingyu135    时间: 2018-5-18 10:32
手动关联?




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