51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2933|回复: 2
打印 上一主题 下一主题

[原创] 紧急求助 loadrunner

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2006-8-2 17:19:55 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
紧急求助 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;
}
我应该在哪里填加参数啊,实在摸索不错来,网高手给予帮助,谢谢啦
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

3#
发表于 2006-8-10 16:11:52 | 只看该作者
奇怪 格式都没了
回复 支持 反对

使用道具 举报

该用户从未签到

2#
发表于 2006-8-10 16:02:37 | 只看该作者
去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 编辑 ]
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-8 23:09 , Processed in 0.067716 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表