51Testing软件测试论坛

标题: 脚本内容缺乏重要数据 [打印本页]

作者: ryhoen    时间: 2009-8-25 10:31
标题: 脚本内容缺乏重要数据
java的客户端程序
用LR录制脚本
尝试过很多协议
发现只有winsocket才能录制
但脚本里面似乎没有看到与后台交换数据的东西
哪这有什么意义呢?
烦求各位高手帮忙解答!
先谢谢了!
作者: xxicy    时间: 2009-8-25 11:05
贴点代码上来看看,不知道“脚本里面似乎没有看到与后台交换数据的东西”到底是什么意思~
作者: ryhoen    时间: 2009-8-25 11:16
标题: 回复 2# 的帖子
这位大哥您好!
帮忙看下,先谢谢了!
以下是我的脚本

#include "lrs.h"


vuser_init()
{
    lrs_startup(257);

    lrs_create_socket("socket0", "TCP", "LocalHost=0", "Backlog=50",  LrsLastArg);

    lrs_create_socket("socket1", "TCP", "LocalHost=0", "Backlog=50",  LrsLastArg);

    lrs_create_socket("socket2", "TCP", "LocalHost=2296", "Backlog=50",  LrsLastArg);

    lrs_create_socket("socket3", "TCP", "LocalHost=0", "Backlog=50",  LrsLastArg);

    lr_think_time(43);

    lrs_create_socket("socket4", "TCP", "LocalHost=0", "RemoteHost=lenovoW-2395031:2296",  LrsLastArg);

    lrs_accept_connection("socket2", "socket5");

    lrs_send("socket4", "buf0", LrsLastArg);

    lrs_receive("socket5", "buf1", LrsLastArg);

    lrs_send("socket5", "buf2", LrsLastArg);

    lrs_receive("socket4", "buf3", LrsLastArg);

    lrs_close_socket("socket4");

    lrs_create_socket("socket6", "TCP", "LocalHost=0", "RemoteHost=lenovoW-2395031:2296",  LrsLastArg);

    lrs_accept_connection("socket2", "socket7");

    lrs_send("socket6", "buf4", LrsLastArg);

    lrs_receive("socket7", "buf5", LrsLastArg);

    lrs_send("socket6", "buf6", LrsLastArg);

    lrs_receive("socket7", "buf7", LrsLastArg);

    lrs_receive("socket6", "buf8", LrsLastArg);

    lrs_send("socket7", "buf9", LrsLastArg);

    lrs_send("socket6", "buf10", LrsLastArg);

    lrs_receive("socket7", "buf11", LrsLastArg);

    lrs_send("socket6", "buf12", LrsLastArg);

    lrs_receive("socket7", "buf13", LrsLastArg);

    lrs_send("socket7", "buf14", LrsLastArg);

    lrs_receive("socket6", "buf15", LrsLastArg);

    lrs_send("socket7", "buf16", LrsLastArg);

    lrs_receive("socket6", "buf17", LrsLastArg);

    lrs_send("socket6", "buf18", LrsLastArg);

    lrs_receive("socket7", "buf19", LrsLastArg);

    lrs_send("socket6", "buf20", LrsLastArg);

    lrs_receive("socket7", "buf21", LrsLastArg);

    lrs_create_socket("socket8", "TCP", "LocalHost=0", "RemoteHost=lenovoW-2395031:2297",  LrsLastArg);

    lrs_accept_connection("socket3", "socket9");

    lrs_send("socket8", "buf22", LrsLastArg);

    lrs_receive("socket9", "buf23", LrsLastArg);

    lrs_send("socket9", "buf24", LrsLastArg);

    lrs_receive("socket8", "buf25", LrsLastArg);

    lrs_close_socket("socket9");

    lrs_receive("socket8", "buf26", LrsLastArg);

    lrs_close_socket("socket8");

    lrs_create_socket("socket10", "TCP", "LocalHost=0", "RemoteHost=lenovoW-2395031:2297",  LrsLastArg);

    lrs_accept_connection("socket3", "socket11");

    lrs_send("socket10", "buf27", LrsLastArg);

    lrs_receive("socket11", "buf28", LrsLastArg);

    lrs_send("socket11", "buf29", LrsLastArg);

    lrs_receive("socket10", "buf30", LrsLastArg);

    lrs_send("socket11", "buf31", LrsLastArg);

    lrs_receive("socket10", "buf32", LrsLastArg);

    return 0;
}


#include "lrs.h"


Action()
{
    lr_think_time(39);

    lrs_create_socket("socket12", "TCP", "RemoteHost=CAIT-SHENZHEN:8080",  LrsLastArg);

    lrs_send("socket12", "buf33", LrsLastArg);

    lrs_receive("socket12", "buf34", LrsLastArg);

    lr_think_time(6);

    lrs_send("socket12", "buf35", LrsLastArg);

    lrs_receive("socket12", "buf36", LrsLastArg);

    lrs_send("socket12", "buf37", LrsLastArg);

    lrs_receive("socket12", "buf38", LrsLastArg);

    return 0;
}

#include "lrs.h"


vuser_end()
{
    lr_think_time(12);

    lrs_send("socket12", "buf39", LrsLastArg);

    lrs_receive("socket12", "buf40", LrsLastArg);

    lrs_cleanup();

    return 0;
}
作者: xxicy    时间: 2009-8-28 15:47
“脚本里面似乎没有看到与后台交换数据的东西”你是不是说只看见发送请求,受到响应,没看到请求和响应的实际的内容?具体的发送和接受的内容在data.ws里面放着,就在vuser_end的下面。
作者: ryhoen    时间: 2009-8-28 16:09
标题: 回复 4# 的帖子
非常感谢您的指点!




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2