C/S 协议数据动态关联的问题!
我在c/s结构的系统压力测试时,碰到有数据是需要做动态关联的,也就是说,要从服务器返回的数据中截取固定长度的字符存成参数,然后发出去的时候把要变化的内容就使用此参数值,现在碰到的问题是,在脚本调试时,没有问题,在场景里运行的时候,只要有10个并发,就会提示保存参数出错,实在找不到原因了,只有请教高人了,脚本代码如下:Vuser_init.c
/*********************************************************************
* Created by Mercury Interactive Windows Sockets Recorder
*
* Created on: Mon Aug 17 15:37:28
*********************************************************************/
#include "lrs.h"
vuser_init()
{
lrs_startup(257);
lrs_set_recv_timeout(2,0);
lrs_set_recv_timeout2(2,0);
lrs_create_socket("socket0", "TCP", "RemoteHost=192.168.1.200:8700",LrsLastArg);
lrs_send("socket0", "buf0", LrsLastArg);
lrs_receive("socket0", "buf1", LrsLastArg);
lrs_send("socket0", "buf2", LrsLastArg);
lrs_receive("socket0", "buf3", LrsLastArg);
lrs_send("socket0", "buf4", LrsLastArg);
lrs_receive("socket0", "buf5", LrsLastArg);
lr_think_time(6);
lrs_send("socket0", "buf6", LrsLastArg);
lrs_receive("socket0", "buf7", LrsLastArg);
// lrs_receive_ex("socket0", "buf7","NumberOfBytesToRecv=2289", LrsLastArg);
lrs_save_param( "socket0", NULL, "SessionId", 545, 32 );
lr_output_message("SessionId=%s",lr_eval_string("<SessionId>"));
//lrs_receive("socket0", "buf7", LrsLastArg);
lrs_send("socket0", "buf8", LrsLastArg);
lrs_receive("socket0", "buf9", LrsLastArg);
lrs_send("socket0", "buf10", LrsLastArg);
lrs_receive("socket0", "buf11", LrsLastArg);
lrs_send("socket0", "buf12", LrsLastArg);
lrs_receive("socket0", "buf13", LrsLastArg);
lrs_send("socket0", "buf14", LrsLastArg);
lrs_receive("socket0", "buf15", LrsLastArg);
lrs_send("socket0", "buf16", LrsLastArg);
lrs_receive("socket0", "buf17", LrsLastArg);
lrs_send("socket0", "buf18", LrsLastArg);
lrs_receive("socket0", "buf19", LrsLastArg); //init_end
return 0;
}
action.c
/*********************************************************************
* Created by Mercury Interactive Windows Sockets Recorder
*
* Created on: Mon Aug 17 15:37:28
*********************************************************************/
#include "lrs.h"
Action()
{
//char cm;
lrs_set_recv_timeout(2,0);
lrs_set_recv_timeout2(2,0);
lr_start_transaction("sendpic");
lr_think_time(18);
lrs_send("socket0", "buf20", LrsLastArg);
lrs_receive("socket0", "buf21", LrsLastArg);
lr_think_time(93);
lrs_send("socket0", "buf22", LrsLastArg);
lrs_receive("socket0", "buf23", LrsLastArg);
lrs_send("socket0", "buf24", LrsLastArg);
//lrs_set_receive_option(EndMarker, RecordingSize);
//lrs_receive_ex("socket0", "buf25", "NumberOfBytesToRecv=557", LrsLastArg);
lrs_receive("socket0", "buf25", LrsLastArg);
lrs_send("socket0", "buf26", LrsLastArg);
lrs_receive("socket0", "buf27", LrsLastArg);
//lrs_receive_ex("socket0", "buf27", "NumberOfBytesToRecv=1604", LrsLastArg);
lrs_set_recv_timeout(5,0);
lrs_set_recv_timeout2(5,0);
lrs_save_param("socket0", NULL, "cm", 1454, 36);
lr_output_message("cm=%s", lr_eval_string("<cm>"));
lr_log_message("cm=%s", lr_eval_string("<cm>"));
lrs_set_recv_timeout(2,0);
lrs_set_recv_timeout2(2,0);
lrs_send("socket0", "buf28", LrsLastArg);
lrs_receive("socket0", "buf29", LrsLastArg);
lr_end_transaction("sendpic", LR_AUTO);
//logout
return 0;
}
vuser_end.c
/*********************************************************************
* Created by Mercury Interactive Windows Sockets Recorder
*
* Created on: Mon Aug 17 15:37:28
*********************************************************************/
#include "lrs.h"
vuser_end()
{
lrs_set_recv_timeout(2,0);
lrs_set_recv_timeout2(2,0);
lr_think_time(14);
lrs_send("socket0", "buf30", LrsLastArg);
lrs_receive("socket0", "buf31", LrsLastArg);
lrs_close_socket("socket0");
lrs_cleanup();
return 0;
}
在场景里跑时,提示lrs_save_param("socket0", NULL, "cm", 1454, 36)这句代码保存参数失败
[ 本帖最后由 xuefeng 于 2009-8-18 15:16 编辑 ] data.rar为data.ws,因为论坛不支持直接上传此文件,在此文件的BUF28里面,将一串字符用CM参数代替了。
还有一个文件为服务器返回的数据,请高人指点一下 把用户数减少看是否报错,另外报错是否是全错 减少到2个都报错,有一个是成功的 有人帮我分析下原因? 1、把服务器返回的实际给出来,我找了半天,不知道哪个是你们服务器返回的数值;
2、将lrs_save_param("socket0", NULL, "cm", 1454, 36)中的1454设大点,36也设置大点,然后再跑试试看,能不能输值,在场景中跑,不设置持续时间,使用1,2,3,4,5等并发,并且设置集合点,完了以后再检查输出的日志文件进行分析。
页:
[1]