Loadrunner 2021 入门

Loadrunner 2021 入门

脚本不会写不求人,我有“帮助中心”;里面有语法介绍和使用示例代码。

帮助中心

一、Virtual User Generator

1.快捷键

快捷键描述
ctrl+space代码补全
ctrl+alt+b步骤工具箱
Action()
{

	/*Possible OAUTH authorization was detected. It is recommended to correlate the authorization parameters.*/

	web_set_sockets_option("SSL_VERSION", "AUTO");

	web_add_header("Origin", 
		"http://192.168.63.20");
	
	web_reg_save_param_json(
        "ParamName=access_token",
        "QueryString=$data.token.access_token",
        SEARCH_FILTERS,
        "Scope=Body",
        "LAST");
	
	web_reg_save_param_json(
        "ParamName=token",
        "QueryString=$data.token",
        SEARCH_FILTERS,
        "Scope=Body",
        "LAST");

	web_custom_request("login", 
		"URL=http://192.168.63.20/prod-api/auth/login", 
		"Method=POST", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://192.168.63.20/", 
		"Snapshot=t1.inf", 
		"Mode=HTML", 
		"EncType=application/json;charset=UTF-8", 
		"Body={\"username\":\"admin\",\"password\":\"123456\"}", 
		LAST);
	
	web_add_cookie("Admin-Token={token}; DOMAIN=192.168.63.20");
	
	lr_log_message("user token is:%s",lr_eval_string("{token}"));
	
	web_add_auto_header("Authorization", "Bearer {access_token}");

	
	web_url("info", 
		"URL=http://192.168.63.20/prod-api/auth/info", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://192.168.63.20/", 
		"Snapshot=t2.inf", 
		"Mode=HTML", 
		LAST);

	web_add_header("Origin", 
		"http://192.168.63.20");

	web_custom_request("10", 
		"URL=http://192.168.63.20/prod-api/eventTask/pageEventTask/1/10", 
		"Method=POST", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://192.168.63.20/", 
		"Snapshot=t4.inf", 
		"Mode=HTML", 
		"EncType=application/json;charset=UTF-8", 
		"Body={\"page\":1,\"limit\":10}", 
		LAST);

	web_url("getTriggerStateCount", 
		"URL=http://192.168.63.20/prod-api/eventTask/getTriggerStateCount", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://192.168.63.20/", 
		"Snapshot=t5.inf", 
		"Mode=HTML", 
		LAST);

	web_url("list", 
		"URL=http://192.168.63.20/prod-api/system/list", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://192.168.63.20/", 
		"Snapshot=t6.inf", 
		"Mode=HTML", 
		LAST);

	web_url("findDatabaseMun", 
		"URL=http://192.168.63.20/prod-api/database/findDatabaseMun", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://192.168.63.20/", 
		"Snapshot=t7.inf", 
		"Mode=HTML", 
		LAST);

	web_url("findInterfaceMun", 
		"URL=http://192.168.63.20/prod-api/interface/findInterfaceMun", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://192.168.63.20/", 
		"Snapshot=t8.inf", 
		"Mode=HTML", 
		LAST);

	web_url("findTopicUse", 
		"URL=http://192.168.63.20/prod-api/subscribe/findTopicUse", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://192.168.63.20/", 
		"Snapshot=t9.inf", 
		"Mode=HTML", 
		LAST);

	web_url("findConsumerUse", 
		"URL=http://192.168.63.20/prod-api/subscribe/findConsumerUse", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://192.168.63.20/", 
		"Snapshot=t10.inf", 
		"Mode=HTML", 
		LAST);

	return 0;
}

脚本

二、Controller

调度

三、Analysis

结果分析

四、运行jmeter脚本

jmeter

jmeter入门示例

九、遇到问题

1.录制脚本时 打不开网页或者打开网页慢

错误截图
解决方案

参考:
loadrunner12.53 录制脚本时 打不开网页或者打开网页慢?

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

搬山境KL攻城狮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值