51Testing软件测试论坛

标题: 紧急求助 loadrunner [打印本页]

作者: zengyin316    时间: 2006-8-2 17:19
标题: 紧急求助 loadrunner
紧急求助 loadrunner

我现在要测试一个类似与 MSN的通信系统的性能,数据库采用的是MySQL ,连接方式为MySql的动态链接库,首先协议应该怎么选择啊,我选择了winSocket协议,也能录制,但我想加入参数,因为至少要模拟10个用户并发操作嘛,提供不用的用户名和密码,我录的登陆脚本如下:
#include "lrs.h"

vuser_init()
{
    lrs_startup(257);

    lr_think_time(32);

    lrs_create_socket("socket0", "TCP", "LocalHost=0", "RemoteHost=202.101.165.141:5222",  LrsLastArg);

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

    lrs_create_socket("socket1", "UDP", "LocalHost=5224",  LrsLastArg);

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

    lrs_send("socket1", "buf2", "TargetSocket=202.101.165.141:5225", LrsLastArg);

    lrs_send("socket0", "buf3", LrsLastArg);

    lrs_receive("socket1", "buf4", LrsLastArg);

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

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

    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);

    return 0;
}
我应该在哪里填加参数啊,实在摸索不错来,网高手给予帮助,谢谢啦
作者: tacy_lee    时间: 2006-8-10 16:02
去data.ws里面参数化

至于要关联的数据,看帮助:



  1. In the following example, a user performed a Telnet session. The user used a ps command to determine a process ID (PID),
  2. and killed the application based on its PID. Repeating the exact steps during replay will not work-during replay the PID will
  3. be different (UNIX assigns a new PID). Killing the PID that was recorded in the script will be ineffective. To overcome this
  4. problem, lr_save_param saves the value of the PID to a parameter during replay. This parameter is referenced in the
  5. Send buffer which contains the kill command.

  6. The following code was recorded. The script would not perform the kill command during replay. To correct this, the following steps were performed:

  7. The recorded value of the PID, 28597 was located along with the socket and buffer descriptors. The offset and length of the data was determined. The buffer shown below, buf47, was received after the ps command. The offset of the PID within the buffer data is 67, and its length is 5.
  8. recv buf47 188 "\r" "\x0" "\r\n""PID TT STAT TIME COMMAND\r\n" "28469 q2 S 0:01 -tcsh (tcsh)\r\n" "28597 q2 T 0:00 vi log1.txt\r\n" "28602 q2 R 0:00 ps\r\n" "tears:/tmp_mnt/u/jay>"

  9. The PID also appeared in the Send buffer, buf48, when the user performed a kill operation to the process.
  10. send buf48 "kill -9 28597"

  11. An lrs_save_param function was placed in the Actions section, before the lrs_send statement, in this instance buffer "buf48". NULL was specified in place of a buffer descriptor, indicating that VuGen should use the last received buffer, "buf47". During each subsequent replay, the PID is saved to a parameter called param1. The parameter was evaluated and printed in the Output window using lr_output_message.
  12.             lrs_receive("socket2", "buf47", LrsLastArg);
  13. lrs_save_param("socket2", NULL, "param1", 67, 5);
  14. lr_output_message ("param1: %s", lr_eval_string("<param1>"));
  15. lr_think_time(10);
  16. lrs_send("socket2", "buf48", LrsLastArg);

  17. The parameter was referenced in the Send buffer in place of the original PID constant. In this example angle brackets were used, but you can define the delimiters from VuGen's Option menu.
  18. send buf48 "kill -9 <param1>"

复制代码


写得很清楚

[ 本帖最后由 tacy_lee 于 2006-8-10 16:11 编辑 ]
作者: tacy_lee    时间: 2006-8-10 16:11
奇怪 格式都没了




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