3.14 编写用例经验以及模拟题性能测试难点

搜索往届国赛测试用例编写经验

21年国赛模拟题性能测试难点

对Ir_out_message()中的数据进行参数化设置,这应该是21年国赛模拟题的难点了

先了解 lr_eval_string和lr_save_string

参数和变量的转换

1)参数转换成变量 lr_eval_string 读取参数的值

2)变量转换成参数 lr_save_string 创建参数。可以将变量写入参数

Action()

{

int a =10;

char name[]="lr";

lr_output_message("变量的取值是:%d",a);

lr_output_message("参数的取值是:%s","{output}");

lr_output_message("参数的取值是:%s",lr_eval_string("{output}"));

lr_save_int(a,"p");

//lr_save_string(name,"p");

lr_output_message("参数的取值是:%s",lr_eval_string("{p}"));

return0;

}

Action.c(5): 变量的取值是:10

Action.c(6): 参数的取值是:{output}

Action.c(7): 参数的取值是:1

Action.c(10): 参数的取值是:10

设置迭代次数6

测试数据phone.bat

phone
13862607106
13862607107
13862607108
13862607109
13862607100
空一行

参数化

测试代码

Action()

{
lr_output_message("取到的值:%s",lr_eval_string("{phone}"));
return 0;
}

运行结果

Virtual User Script started at: 2022/3/13 12:55:27

Starting action vuser_init.

Web Turbo Replay of LoadRunner 2021.0.0 for Windows 10; build 430 (1月 05 2021 19:27:22) [MsgId: MMSG-26983]

Run mode: HTML [MsgId: MMSG-26993]

Replay user agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0) [MsgId: MMSG-26988]

Runtime Settings file: "D:\Documents\VuGen\Scripts\xnb001\\default.cfg" [MsgId: MMSG-27141]

Ending action vuser_init.

Running Vuser...

Starting iteration 1.

Maximum number of concurrent connections per server: 6 [MsgId: MMSG-26989]

Starting action Action.

Action.c(4): Notify: Parameter Substitution: parameter "phone" = "13862607106"

Action.c(4): 取到的值:13862607106

Ending action Action.

Ending iteration 1.

Starting iteration 2.

Notify: Next row for parameter phone = 2 [table = phone].

Notify: Getting new value for parameter 'phone': table = 'phone.dat' column = '0' row = '2'.

Starting action Action.

Action.c(4): Notify: Parameter Substitution: parameter "phone" = "13862607107"

Action.c(4): 取到的值:13862607107

Ending action Action.

Ending iteration 2.

Starting iteration 3.

Notify: Next row for parameter phone = 3 [table = phone].

Notify: Getting new value for parameter 'phone': table = 'phone.dat' column = '0' row = '3'.

Starting action Action.

Action.c(4): Notify: Parameter Substitution: parameter "phone" = "13862607108"

Action.c(4): 取到的值:13862607108

Ending action Action.

Ending iteration 3.

Starting iteration 4.

Notify: Next row for parameter phone = 4 [table = phone].

Notify: Getting new value for parameter 'phone': table = 'phone.dat' column = '0' row = '4'.

Starting action Action.

Action.c(4): Notify: Parameter Substitution: parameter "phone" = "13862607109"

Action.c(4): 取到的值:13862607109

Ending action Action.

Ending iteration 4.

Starting iteration 5.

Notify: Next row for parameter phone = 5 [table = phone].

Notify: Getting new value for parameter 'phone': table = 'phone.dat' column = '0' row = '5'.

Starting action Action.

Action.c(4): Notify: Parameter Substitution: parameter "phone" = "13862607100"

Action.c(4): 取到的值:13862607100

Ending action Action.

Ending iteration 5.

Starting iteration 6.

Notify: Next row for parameter phone = 1 [table = phone].

Notify: Getting new value for parameter 'phone': table = 'phone.dat' column = '0' row = '1'.

Starting action Action.

Action.c(4): Notify: Parameter Substitution: parameter "phone" = "13862607106"

Action.c(4): 取到的值:13862607106

Ending action Action.

Ending iteration 6.

Ending Vuser...

Starting action vuser_end.

Ending action vuser_end.

Vuser Terminated.

结束,截图

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值