51Testing软件测试论坛
标题:
求助lr_paramarr_idx输出
[打印本页]
作者:
error1
时间:
2014-6-20 17:40
标题:
求助lr_paramarr_idx输出
本帖最后由 error1 于 2014-6-20 22:33 编辑
Example: lr_paramarr_idx and lr_paramarr_len
This example shows how to get the last value from a parameter array.
int arrSize;
char * FlightVal;
web_reg_save_param("outFlightVal",
"LB=outboundFlight value=", "RB=>",
"ORD=ALL",
"SaveLen=18",
LAST );
web_submit_form("reservations.pl",
"Snapshot=t4.inf",
ITEMDATA,
"Name=depart", "Value=London", ENDITEM,
"Name=departDate", "Value=11/20/2003", ENDITEM,
"Name=arrive", "Value=New York", ENDITEM,
"Name=returnDate", "Value=11/21/2003", ENDITEM,
"Name=numPassengers", "Value=1", ENDITEM,
"Name=roundtrip", "Value=<OFF>", ENDITEM,
"Name=seatPref", "Value=None", ENDITEM,
"Name=seatType", "Value=Coach", ENDITEM,
"Name=findFlights.x", "Value=83", ENDITEM,
"Name=findFlights.y", "Value=16", ENDITEM,
LAST );
/*
The result of the web_reg_save_param having been called before the web_submit_form is:
Notify: Saving Parameter "outFlightVal_1 = 230;378;11/20/2003"
Notify: Saving Parameter "outFlightVal_2 = 231;337;11/20/2003"
Notify: Saving Parameter "outFlightVal_3 = 232;357;11/20/2003"
Notify: Saving Parameter "outFlightVal_4 = 233;309;11/20/2003"
Notify: Saving Parameter "outFlightVal_count = 4"
*/
arrSize = lr_paramarr_len("outFlightVal");
FlightVal = lr_paramarr_idx("outFlightVal", arrSize);
// FlightVal contains the value "233;309;11/20/2003".
复制代码
以上是官方帮助文档里的,以下是我自己的
srand(time(NULL));
i = rand()%20;
i = i+1;
lr_save_string(lr_paramarr_idx("projSysID",i),"p_projSysID");
lr_output_message("p_projSysID=%s",lr_eval_string("{p_projSysID}"));
//最后的输出如下:
Action.c(145): p_projSysID={projSysID_5}
复制代码
问下为什么输出的不是projSysID_9的值???
作者:
error1
时间:
2014-6-24 22:46
没人回答吗?
作者:
fiskeryang
时间:
2014-6-26 17:22
projSysID 这个参数数组在哪里敷的值
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2