|
进行一个简单的增-查询-删的操作,查询新增的一条纪录,然后使用web_reg_save存储这个返回的id,在删除的时候取这个id删除。脚本如下:从查询的脚本开始发,后面是删除的脚本,因为在查询里面插入了web_reg_save的函数:
char regidPram[50]; //保存取到的流水号
char regidPramVal[50]; //保存以"Value=流水号"取到的流水号。
query()
{
web_reg_find("Text=局向管理",
LAST);
web_url("bsiteMain.jsp_2",
"URL=http://172.16.5.232:6677/Omega/pages/location/bsiteMain.jsp?op=query&locationId=&bsiteName=&bsiteCode=zhangaa&remark=&bsiteState=&nodeId=",
"Resource=0",
"RecContentType=text/html",
"Referer=http://172.16.5.232:6677/Omega/login.do",
"Snapshot=t80.inf",
"Mode=HTTP",
LAST);
web_concurrent_start(NULL);
web_url
。
。
。此处省略);
web_concurrent_end(NULL);
web_submit_data("systemCfg.do_4",
"Action=http://172.16.5.232:6677/Omega/pages/location/systemCfg.do?type=1&table=OMGBSITE&column=STATUS",
"Method=POST",
"Referer=http://172.16.5.232:6677/Omega/pages/location/bsiteMain.jsp?op=query&locationId=&bsiteName=&bsiteCode=zhangaa&remark=&bsiteState=&nodeId=",
"Snapshot=t95.inf",
"Mode=HTTP",
ITEMDATA,
LAST);
web_url("systemCfg.do_5",
"URL=http://172.16.5.232:6677/Omega/pages/location/systemCfg.do?type=12&_dc=1219734716796",
"Resource=1",
"Referer=http://172.16.5.232:6677/Omega/pages/location/bsiteMain.jsp?op=query&locationId=&bsiteName=&bsiteCode=zhangaa&remark=&bsiteState=&nodeId=",
"Snapshot=t96.inf",
LAST);
web_custom_request("TreeUtil.getPermByOperator.dwr_4",
"URL=http://172.16.5.232:6677/Omega/dwr/exec/TreeUtil.getPermByOperator.dwr",
"Method=POST",
"Resource=1",
"RecContentType=text/plain",
"Referer=http://172.16.5.232:6677/Omega/pages/location/bsiteMain.jsp?op=query&locationId=&bsiteName=&bsiteCode=zhangaa&remark=&bsiteState=&nodeId=",
"Snapshot=t97.inf",
"EncType=text/plain",
"Body=callCount=1\n"
"c0-scriptName=TreeUtil\n"
"c0-methodName=getPermByOperator\n"
"c0-id=7356_1219734717000\n"
"c0-param0=string:21\n"
"xml=true\n"
"",
LAST);
web_reg_save_param("regid",
"LB=id:'",
"RB=',status",
"Ord=ALL",
"Search=Body",
"RelFrameId=1",
LAST);
web_submit_data("bsiteQuery.do",
"Action=http://172.16.5.232:6677/Omega/pages/location/bsiteQuery.do?",
"Method=POST",
"Referer=http://172.16.5.232:6677/Omega/pages/location/bsiteMain.jsp?op=query&locationId=&bsiteName=&bsiteCode=zhangaa&remark=&bsiteState=&nodeId=",
"Snapshot=t98.inf",
"Mode=HTTP",
ITEMDATA,
"Name=start", "Value=0", ENDITEM,
"Name=limit", "Value=20", ENDITEM,
"Name=locationId", "Value=", ENDITEM,
"Name=bsiteName", "Value=", ENDITEM,
"Name=bsiteCode", "Value={bsitecode}", ENDITEM,
"Name=remark", "Value=", ENDITEM,
"Name=superiorBsite", "Value=null", ENDITEM,
"Name=bsiteState", "Value=", ENDITEM,
"Name=op", "Value=query", ENDITEM,
LAST);
lr_message("regid:%s",lr_eval_string("{regid}"));
//打印出关联的参数regid的值。
sprintf(regidPram,"{regid_%s}",lr_eval_string("{regid_count}"));
//把取到流水号保存到regidPram里,具体形式为
sprintf(regidPramVal,"Value=%s",lr_eval_string(regidPram));
//组合流水号和”Value=”并保存到regidPramVal变量中。
lr_message("The value argument is : %s", regidPramVal);
//打印出字符串变量regidPramVal的值。
web_url("locationQuery.do_2",
"URL=http://172.16.5.232:6677/Omega/pages/location/locationQuery.do?comOp=qAll&_dc=1219734719953",
"Resource=1",
"Referer=http://172.16.5.232:6677/Omega/pages/location/bsiteMain.jsp?op=query&locationId=&bsiteName=&bsiteCode=zhangaa&remark=&bsiteState=&nodeId=",
"Snapshot=t99.inf",
LAST);
lr_think_time(1);
return 0;
}
del()
{
web_submit_data("bsiteManage.do_3",
"Action=http://172.16.5.232:6677/Omega/pages/location/bsiteManage.do?",
"Method=POST",
"Referer=http://172.16.5.232:6677/Omega/pages/location/bsiteMain.jsp?op=query&locationId=&bsiteName=&bsiteCode=zhangaa&remark=&bsiteState=&nodeId=",
"Snapshot=t100.inf",
"Mode=HTTP",
ITEMDATA,
"Name=op", "Value=del", ENDITEM,
"Name=ids", regidPramVal, ENDITEM,
LAST);
web_submit_data("bsiteQuery.do_2",
"Action=http://172.16.5.232:6677/Omega/pages/location/bsiteQuery.do?",
"Method=POST",
"Referer=http://172.16.5.232:6677/Omega/pages/location/bsiteMain.jsp?op=query&locationId=&bsiteName=&bsiteCode=zhangaa&remark=&bsiteState=&nodeId=",
"Snapshot=t101.inf",
"Mode=HTTP",
ITEMDATA,
"Name=start", "Value=0", ENDITEM,
"Name=limit", "Value=20", ENDITEM,
"Name=locationId", "Value=", ENDITEM,
"Name=bsiteName", "Value=", ENDITEM,
"Name=bsiteCode", regidPramVal, ENDITEM,
"Name=remark", "Value=", ENDITEM,
"Name=superiorBsite", "Value=null", ENDITEM,
"Name=bsiteState", "Value=", ENDITEM,
"Name=op", "Value=query", ENDITEM,
LAST);
return 0;
}
执行log:
query.c(166): Registering web_reg_save_param was successful [MsgId: MMSG-26390]
query.c(173): Notify: Parameter Substitution: parameter "bsitecode" = "zhang1"
query.c(173): Notify: Saving Parameter "regid_1 = 382"
query.c(173): Notify: Saving Parameter "regid_2 = 381"
query.c(173): Notify: Saving Parameter "regid_count = 2"
query.c(173): web_submit_data("bsiteQuery.do") was successful, 282 body bytes, 203 header bytes [MsgId: MMSG-26386]
query.c(190): Notify: Parameter Substitution: parameter "regid" = "302"
regid:302
query.c(192): Notify: Parameter Substitution: parameter "regid_count" = "2"
query.c(194): Notify: Parameter Substitution: parameter "regid_2" = "381"
The value argument is : Value=381
query.c(198): web_url("locationQuery.do_2") was successful, 622 body bytes, 203 header bytes [MsgId: MMSG-26386]
Ending action query.
Starting action del.
del.c(3): web_submit_data("bsiteManage.do_3") was successful, 37 body bytes, 202 header bytes [MsgId: MMSG-26386]
del.c(14): web_submit_data("bsiteQuery.do_2") was successful, 19 body bytes, 202 header bytes [MsgId: MMSG-26386]
Ending action del.
Ending iteration 1.
Ending Vuser...
但是在跑脚本的时候报错如下:
del.c(3): Error -26612: HTTP Status-Code=500 (Internal Server Error) for "http://172.16.5.232:6677/Omega/pages/location/bsiteManage.do?"
各位大虾,我迷茫啊~~为什么呢?? |
|