• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

LoadRunner字符串与参数的操作及转换技巧

发布: 2008-10-08 14:43 | 作者: ppent | 来源: ppent 的博客 | 查看: 353次 | 进入软件测试论坛讨论

领测软件测试网  刚开始学LR时,经常搞不清楚变量和参数的区别与用法,最近在一次脚本编写中,整理出来的一些小技巧,与大家一起分享。

//字符串复制
strcpy(str,"Hello ") ;

//字符串连接
strcat(str,"World !");
lr_message("str: %s",str);


//变量转为参数,将变量str的值存到参数Param中
lr_save_string(str,"Param");


//参数复制
lr_save_string(lr_eval_string("{Param}"),"Param_1");

 

//参数转为变量
strcpy(str1,lr_eval_string("{Param_1}"));
lr_message("str1: %s",str1);


//参数名称格式化输出到变量中
sprintf(str2,"{Param_%d}",1);
lr_message("str2: %s",lr_eval_string(str2));


运行结果:
str: Hello World !
vuser_init.c(14): Notify: Saving Parameter "Param = Hello World !"
vuser_init.c(19): Notify: Parameter Substitution: parameter "Param" =  "Hello World !"
vuser_init.c(19): Notify: Saving Parameter "Param_1 = Hello World !"
vuser_init.c(24): Notify: Parameter Substitution: parameter "Param_1" =  "Hello World !"
str1: Hello World !
vuser_init.c(30): Notify: Parameter Substitution: parameter "Param_1" =  "Hello World !"
str2: Hello World !

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/

TAG: loadrunner LoadRunner Loadrunner loadRunner 参数 技巧 字符


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网