51Testing软件测试论坛
标题:
[请教]Loadrunner使用socket的几个问题
[打印本页]
作者:
hanvey
时间:
2005-3-1 10:11
标题:
[请教]Loadrunner使用socket的几个问题
初来乍到,请各位多多帮忙。
使用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;
}
作者:
hanvey
时间:
2005-3-1 11:29
咋没有人理呢?
自己UP。
作者:
bsd3000
时间:
2005-3-1 14:21
1、分析一下出错时的运行日志和错误信息;
2、脚本回放时就是通过检查实际接收到的Buffer的长度是否与录制时的一致来判断回放是否成功的,并不要求内容一致。
3、默认的参数大括号是花括号还是尖括号,取决于协议类型。可以从“工具——常规选项”对话框中的“参数化”选项卡中更改参数大括号。
作者:
hanvey
时间:
2005-3-1 15:42
谢谢这位老大
还有个问题,我重复执行的过程中lrs_create_socket会出现socket 的10054的错误。
我估计第一个问题可能跟这个错误有关系,请问有什么办法解决不?
作者:
hanvey
时间:
2005-3-1 16:18
还有,第46个buf发送到服务器,服务器已经收到了。并且也发送信息给了客户端。
但是客户端再buf47没有收到,直到buf49才收到,并且再buf46之后,服务器就接收不到客户端的请求了。
作者:
bsd3000
时间:
2005-3-1 16:39
我很少用WinSock协议来做实际的测试。
这个问题你仔细分析一下日志,判断出出错原因,才好想办法解决。
作者:
hanvey
时间:
2005-3-3 13:23
至今还未搞定,只好考虑放弃lr。
无奈……
作者:
lin85210
时间:
2007-9-24 21:37
我也想弄明白 让服务器一直传过来的数据,不考虑大小,也不考虑信息,只要发送就可以,怎么实现呢?
有的MSN
linjunjie85210@hotmail.com
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2