51Testing软件测试论坛

标题: 用sock录制,data.ws中的数据怎么做关联? [打印本页]

作者: andrew_zx    时间: 2006-6-2 21:13
标题: 用sock录制,data.ws中的数据怎么做关联?
用sock录制,data.ws中的数据怎么做关联?
作者: andrew_zx    时间: 2006-6-3 15:06
ding
作者: Zee    时间: 2006-6-3 19:39
找到数据关系就是了。步骤一样的
作者: andrew_zx    时间: 2006-6-5 10:15
那么那些函数(web_reg_save_param.......)写在哪里?

action里面还是 data.ws里面???

谢谢
作者: yuxingxin    时间: 2006-6-5 10:17
当然是action中。
作者: thefirstred    时间: 2006-6-5 10:50
不能用web_reg_save_param函数,socks脚本有自己的函数
作者: andrew_zx    时间: 2006-6-5 11:15
data.ws中我要换的是    282888a80b7048b0010b70e1b44b0014

send  buf137 289
        "<body rid='765740' sid='282888a80b7048b0010b70e1b44b0014' xmlns='http://ja"
        "bber.org/protocol/httpbind' key='1541120fac8eec02e7e525f03c816280aebdab43'"
        " ><iq type=\"get\" id=\"auth1\"><query xmlns=\"jabber:iq:auth\"><username>"
        "~200127.03.eb15accc6fc720060602172941176</username></query></iq>\r\n"
        "</body>"


Action中是这段

    lrs_send("socket1", "buf137", LrsLastArg);
-----------------------------------------------------------------------

谢谢拉

到底要用什么函数?写在Action的哪里啊?
作者: Zee    时间: 2006-6-5 11:56
看看一个例子。

For example, lets say you have to capture the PID from the following receive buffer (This is
an example from LR function reference):
"\r"
"\x0 blah blah blah "
"\r\n blah blah blah "
"PID TT STAT TIME COMMAND\r\n PID 28469 q2"
" S 0:01 -tcsh (tcsh)\r\n"
……
In a typical web script, you would use a web_create_html_param and use “PID “ and “ q2” as
the boundaries to capture the data.
In a Winsock script, you would use lrs_save_param that saves data from a static or received
buffer to a parameter. See the example below:
lrs_receive("socket2", "buf47", LrsLastArg);
lrs_save_param("socket2", NULL, "param1", 67, 5);
Unlike web_create_html_param, lrs_save_param goes after the request is made. In
this example, the first statement is receiving buf47. The following are the arguments
used in the lrs_save_param statement:
socket2: Capture from a buffer on socket2
NULL: NULL indicates that the parameter should be captured from the last received buffer. In
this case it is buf47. If you were to capture from any other buffer, you will have to specify the
buffer number.
param1: Name of the LR parameter in which to staore the captured value
67: Offset – explained below.
5: length of the to be captured
Offset: This is the number of bytes from the beginning of the buffer to start capturing. In the
above example, the PID starts after 67 bytes from the beginning of buf47. How do you
determine this?
Highlight the whole buffer in data.ws that contains the parameter to be captured and hit F7.
This will bring up a window as shown below:
In the left column, you will see the offset that corresponds to that line. In the middle 4
columns, you see the EBCDIC translation of the buffer. And in the right column, you have the
actual buffer itself. So if you look at the fifth line in the actual buffer, that is where you PID
lies. But we want to start capturing after the third location in that line. The offset for that
entire line is 64, and the offset for the PID within that line is 3, which makes the offset 67.
(Now does that explain why I had to add all those blah blah blahs in the buffer to make it
match my example? J)
作者: andrew_zx    时间: 2006-6-5 13:09
我的receive buffer 里面没有这个sessionid(282888a80b7048b0010b70e1b44b0014
)字符串
作者: Zee    时间: 2006-6-5 13:12
原帖由 andrew_zx 于 2006-6-5 13:09 发表
我的receive buffer 里面没有这个sessionid(282888a80b7048b0010b70e1b44b0014
)字符串

我说了是个例子,你不能照搬嘛,你要看你自己的里面的相应的变量。
作者: andrew_zx    时间: 2006-6-5 13:25
现在重点是,我不知道sessionid从哪里取的,再放到send的那些函数里,现在录制下来的data.ws里只有send数据包里有sessionid
作者: andrew_zx    时间: 2006-6-5 17:21
大家帮帮忙啊

谢谢了
作者: andrew_zx    时间: 2006-6-6 09:35
help
作者: yuxingxin    时间: 2006-6-6 13:52
你都不知道那个session是从哪儿来的,别人怎么会知道?
除非这儿有人是上帝。
作者: leey    时间: 2006-6-7 16:34
手工关联
手工添加函数,把最后收到的buffer保存到字符串数组,然后取出你要的,然后指定要发出的buffer。
作者: yxd2006    时间: 2012-6-10 16:35
关注中……




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