|
初来乍到,请各位多多帮忙。
使用loadrunner录制的socket程序测试脚本,出现如下的问题:
1. 在执行到47个buf之后,lrs_send发送的请求服务器接收不到?很莫名奇妙,有时候前几个就这样了,好像很不稳定?
2.lrs_receive总是验证录制时接收的内容,但是服务器程序每次返回的内容是不一样的,长度也不一样,怎样不让它验证?或者让他每次都验证成功?
3.还有,我的socket发送和接收到的都是xml字符串,每次在log中总是出现waring,说“×××不是个参数”,lr7.8中把<>做为参数的标记了,怎样才能不出这些waring?
附我录制修改的脚本:
Action()
{
int rtn;
lrs_create_socket("socket0", "TCP", "RemoteHost=10.1.2.19:5050", LrsLastArg);
lrs_set_recv_timeout(1, 500);
lrs_set_recv_timeout2(1, 500);
lrs_send("socket0", "buf0", LrsLastArg);
rtn = lrs_receive_ex("socket0", "buf1", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("The return number:%d\n",rtn);
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_save_searched_string("socket0", LRS_LAST_RECEIVED, "PSession", "LB=<sessionid>", "RB=</sessionid>", 1, 0, -1);
lrs_send("socket0", "buf2", LrsLastArg);
rtn = lrs_receive_ex("socket0", "buf3", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf4", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf5", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf6", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf7", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf8", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf9", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf10", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf11", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf12", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf13", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf14", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf15", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf16", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf17", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf18", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf19", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf20", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf21", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf22", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf23", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf24", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf25", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf26", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf27", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf28", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf29", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf30", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf31", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf32", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf33", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf34", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf35", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf36", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf37", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf38", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf39", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf40", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf41", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf42", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf43", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf44", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf45", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf46", LrsLastArg);
lr_think_time(1);
rtn=lrs_receive_ex("socket0", "buf47", LrsLastArg);
lr_output_message("Returned code buf47:%d\n",rtn);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf48", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf49", LrsLastArg);
lr_output_message("Returned code buf49:%d\n",rtn);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
lrs_send("socket0", "buf50", LrsLastArg);
rtn=lrs_receive_ex("socket0", "buf51", LrsLastArg);
if(rtn != 0 && rtn!=9101)
{
lr_output_message("Error Recive Message from socket0!");
return -1;
}
return 0;
} |
|