qileilove

blog已经转移至github,大家请访问 http://qaseven.github.io/

LR关于对参数进行截取操作的实践

脚本:

Action()
{
char *username;
lr_output_message("参数值为:%s",lr_eval_string("{NewParam}"));
username=lr_eval_string("{NewParam}");
lr_output_message("username的值是:%s",username);
lr_output_message("截取后的值:%s",strtok(lr_eval_string("{NewParam}"),"kibon"));
//strtok 返回特殊标记分割的字符
lr_save_string((char*)strtok(lr_eval_string("{NewParam}"),"kibon"),"temp");
lr_output_message("变量的值为:%s",lr_eval_string("{temp}"));
return 0;
}

  执行结果:

Starting iteration 1.
Starting action Action.
Action.c(5): Notify: Parameter Substitution: parameter "NewParam" =  "kibon001"
Action.c(5): 参数值为:kibon001
Action.c(7): Notify: Parameter Substitution: parameter "NewParam" =  "kibon001"
Action.c(9): username的值是:kibon001
Action.c(11): Notify: Parameter Substitution: parameter "NewParam" =  "kibon001"
Action.c(11): 截取后的值:001
Action.c(14): Notify: Parameter Substitution: parameter "NewParam" =  "kibon001"
Action.c(14): Notify: Saving Parameter "temp = 001".
Action.c(16): Notify: Parameter Substitution: parameter "temp" =  "001"
Action.c(16): 变量的值为:001
Ending action Action.
Ending iteration 1.

posted on 2013-09-27 10:40 顺其自然EVO 阅读(1061) 评论(0)  编辑  收藏 所属分类: loadrunner


只有注册用户登录后才能发表评论。


网站导航:
 
<2013年9月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

导航

统计

常用链接

留言簿(55)

随笔分类

随笔档案

文章分类

文章档案

搜索

最新评论

阅读排行榜

评论排行榜