51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2706|回复: 3
打印 上一主题 下一主题

[原创] lr.get_attrib_double函数怎么用

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2009-1-2 16:12:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
HP LoadRunner Online Function Reference > Utility Functions: Java Language (lr.) > Command Line Parsing Functions
里面有个lr_get_attrib_double 函数,它的JAVA SAMPLE里是这么写的,看不太明白,有人知道具体例子怎么用的么:

In the following example, lr.get_attrib_double retrieves the value of the time parameter from the command line string

test1   -host sun2   -loop 4   -time 1.5

where test1 is the name of the executable and host, loop and time are command line options. lr.get_attrib_double assigns the value to a variable, wait_time. This variable is incorporated into the script and sets how long to wait between loops.

....//

       double wait_time;

       int i;

        

       wait_time=lr.get_attrib_double("time");

       if (wait_time==0){

              lr.message("Illegal time value \n");

              return;

       }

这段脚本要放在那里啊,INIT,ACTION?

我两个地方都试运行了一下,不报错但是没输出结果。
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2009-1-2 22:06:07 | 只看该作者
应该放在Action里吧。
回复 支持 反对

使用道具 举报

该用户从未签到

3#
发表于 2009-1-3 13:45:57 | 只看该作者

试下这样操作,参考下!

action
{
double wait_time;

long secInYear;

char *mrsCollins;

long t;

int i, loops = 3;

        

wait_time=lr_get_attrib_double("time");

secInYear = lr_get_attrib_long ("secondsInYear");

mrsCollins =lr_get_attrib_string ("MrsCollins");

if ( wait_time <= 0 ){

       lr_message("Illegal time value = %f \n", wait_time);

       return;

}else

{

       lr_message("Wait time value = %f", wait_time);

       lr_message("The number of seconds in a year is %ld",

              secInYear);

       lr_message("Mr. Collins' wife is named %s Lucas",

              mrsCollins);

}

for (i=0; i < loops; ++i) {

       time(&t);

       lr_message("Time and date: %s", ctime(&t));

       lr_think_time(wait_time);

       }

       time(&t);

       lr_message("time and date: %s", ctime(&t));}

return 0;

}
回复 支持 反对

使用道具 举报

本版积分规则

关闭

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

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

GMT+8, 2024-9-25 12:28 , Processed in 0.078014 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

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