loadrunner个人笔记

VPN:

(1)VPN没法一概而论,各个厂商技术是不太一样的,加密算法种类有很多

(2)不同VPN产品功能、配置也有差别

(3)LoadRunner应该只支持国际加密算法,国产加密算法应该不支持

快捷键:

 

创建场景配置:

两个同时

去四:日志、时间、模拟、其他自动事务

加一:首选项

关闭集合点:

参数设置

100个用户

开始时间

沟通官方

MFI-sw.support.gsd.imsc.sda.global@opentext.com

support.case@microfocus.com

License团队的邮箱地址:MFI-licensesapac@opentext.com

支持资源 | Micro Focus | OpenText

https://admhelp.microfocus.com/vugen/zh-CN/25.1/help/WebHelp/Content/LandingPages/System-Requirements.htm

官方链接:

https://sld.microfocus.com/mysoftware/index

更新升级loadrunner24.3报错

下载,选择,获取,更新

常用命令:

1、跑容量:

关闭集合点、去四选三+迭代一般设置250,跑两个小时或者三个求平均时间

关闭集合点

2、 设置检查点集合点——集合点放在事务开始前

   web_set_user("{username}",

        lr_decrypt("669492b631ee0363ef86455b"),

        "39.100.127.238:8080");

//设置密码加密传输



    lr_rendezvous("yuyueguahao");//插入预约挂号的集合点



    lr_start_transaction("yuyueguahao");//预约挂号事务开始

//设置检查点,放在响应数据连接之前

    web_reg_find("Search=All",

        "SaveCount=mess",

        "Text=成功",

        LAST);

//检查是否查到检查点,检测到通过,检查不到失败,关闭事务的位置

if(atoi(lr_eval_string("{mess}")) > 0){

       

        lr_end_transaction("quxiaoyuyue",LR_PASS);

    

    }else{

       

        lr_end_transaction("quxiaoyuyue",LR_FAIL);

    }



3、关联——关联放在返回数据的链接之前

关联一:
	web_reg_save_param_json(
		"ParamName=appointid",
		"QueryString=$.rows[0].appointid",
		SEARCH_FILTERS,
		LAST);

关联二:
	web_set_max_html_param_len("2560");

	web_reg_save_param_ex(
		"ParamName=tokenCancelPage",
		"LB= name=\"tokenCancelPage\" value=\"",
		"RB=\" class=\"hidd",
		SEARCH_FILTERS,
		LAST);

 关联三:遇到的注意点

1、id需要关联不要参数化

2、id关联的时候主要关联是多个的还是单个数据

 

4、参数设置

(1)登录——用户登录的设置

(2)登录——用户登录之外其他场景的设置

(3)登录——创建用户场景的设置(适用于其他的创建)

第一:要创建大量的数据

5、常见设置: 

Action()
{   
	//插入集合点
    lr_rendezvous("login");
    //开始事务
	lr_start_transaction("login");

	web_add_header("Accept-Language", 
		"zh-CN,zh;q=0.9");
	//设置检查点
    web_reg_find("Search=All",
		"Text=username",
		"SaveCount=count",
		LAST);
	web_submit_data("form", 
		"Action=http://47.92.87.203:8080/login/form", 
		"Method=POST", 
		"TargetFrame=", 
		"RecContentType=text/html", 
		"Referer=http://47.92.87.203:8080/login", 
		"Snapshot=t2.inf", 
		"Mode=HTML", 
		ITEMDATA, 
		"Name=username", "Value={user001}", ENDITEM, 
		"Name=password", "Value=test1234", ENDITEM, 
		LAST);

	//结束事务

//	lr_end_transaction("login",LR_AUTO);
	//判断是否登录成功
 

	if(atoi(lr_eval_string("{count}")) > 0){
	    lr_end_transaction("login", LR_PASS);
	}else{
	    lr_end_transaction("login", LR_FAIL);
	   }
	   	

	return 0;
}

6、更新脚本和配置 

 

7、 token在init里面

第一:找到响应里有token值的链接,在前面添加关联

	web_set_sockets_option("SSL_VERSION",
		"AUTO");

		web_reg_save_param_ex(
		"ParamName=token",
		"LB=\"token\":\"",
		"RB=\"}",
		SEARCH_FILTERS,
		"Scope=ALL",
		LAST);
	web_custom_request("login", 
		"URL=http://192.168.10.13:8091/prod-api/login", 
		"Method=POST", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://192.168.10.13:8091/login?redirect=%2Findex", 
		"Snapshot=t11.inf", 
		"Mode=HTML", 
		"EncType=application/json;charset=UTF-8", 
		"Body={\"username\":\"{user_1}\",\"password\":\"123456\"}", 
		LAST);

//eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjZjOTFkNjY2LWRiNWQtNDk5Mi1iZThlLWU2M2MwOGE5NWZkNyJ9.s6TnPC1VHr2gyq5dmPRQQ3EuH3S9F7FrM4TsAVUH2EFRZj4JeHUx_eDlNyGk3YOh-PsZRhV0X6fJPibvwsk43A
	web_add_cookie("Admin-Token={token}; DOMAIN=192.168.10.13");

第二步:找到action添加下列数据:

	web_add_auto_header("Authorization",
		"Bearer {token}");

 8、报告——TPS

9、日志 

(1)失败的用户日志

常用业务

1、导出业务

init

web_reg_save_param("token",
		"LB=token\":\"",
		"RB=\"",
		"NotFound=ERROR",
		"Search=Body",
		LAST);
	
	
	web_custom_request("login_2", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/sys/login?_t=1728628081936", 
		"Method=POST", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t257.inf", 
		"Mode=HTTP", 
		"EncType=application/json;charset=UTF-8", 
		"Body={\"username\":\"{user}\",\"password\":\"39edfc7bf5d3441ded00c2d72ed4f69b\",\"code\":\"059014535dcfa3d41daa03b7fa6b35c3\",\"uuid\":\"\"}", 
		LAST);
	
		web_add_auto_header("token",
		"{token}");

action

Action()
{

	//定义一个整型变量保存获得文件的大小
	int flen;
	
	//保存文件句柄
	long filedes;

	//保存文件路径及文件名
	char file[256]="\0";
	char * chNumber ;
	int time;
	
	web_custom_request("list", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/paging/list?_t=1728699161024", 
		"Method=OPTIONS", 
		"Resource=0", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t138.inf", 
		"Mode=HTTP", 
		LAST);

	web_custom_request("list_2", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/paging/list?_t=1728699161024", 
		"Method=POST", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t139.inf", 
		"Mode=HTTP", 
		"EncType=application/json;charset=UTF-8", 
		"Body={\"current\":1,\"size\":10,\"productName\":\"\",\"fileCategory\":\"加热器具产品图片\"}", 
		LAST);

	lr_think_time(9);

	

	//设置页面接收最大的字节数,该设置应大于下载文件的大小
	web_set_max_html_param_len("1024000");
	
	//集合点
	lr_rendezvous("daochu");

	//导出事务开始
	lr_start_transaction("daochu");
	
	
	//使用关联函数获取下载文件的内容
	web_reg_save_param("filecontent",
		"LB=",
		"RB=",
		"Search=BODY",
		LAST);
	
	web_url("excel", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/export/excel?productName=&heatingMode=&structure=&adapterYan=&fileCategory=%E5%8A%A0%E7%83%AD%E5%99%A8%E5%85%B7%E4%BA%A7%E5%93%81%E5%9B%BE%E7%89%87&token={token}", 
		"Resource=1", 
		"RecContentType=application/force-download", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t140.inf", 
		LAST);

	lr_output_message(lr_eval_string("{filecontent}"));



	//获得下载文件大小
	flen =web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);

	time=web_get_int_property (HTTP_INFO_DOWNLOAD_TIME);

	lr_output_message("下载时间是%d",time);


	//生成随机数
	chNumber=lr_eval_string("{NewParam}");


	//将下载文件要保存的路径存到file里
	strcat(file,"D:\\file\\");

	//在文件名后自动生成随机数
	strcat(file,chNumber);

	//下载的文件后缀名称
	strcat(file,".xlsx");
	//如果文件夹大于0的情况下,尝试以二进制写入模式(“wb”)打开文件,如果fopen函数返回null,表示文件打开失败。此时lr_output_message输出错误信息,并返回return -1表示函数执行失败。
	if(flen > 0)
	{
	  if((filedes = fopen(file,"wb")) == NULL)
	  {
		lr_output_message("Open FileFailed!", lr_eval_string("{filecontent}"));
		return -1;
	  }
	  //fwrite函数将filecontent参数(通过lr_eval_string函数解析)的内容写入到打开的文件中。写入的字节数为flen,写入一次
	fwrite(lr_eval_string("{filecontent}"),flen,1,filedes );
	//用于关闭之前打开的文件,释放相关的资源
	fclose( filedes );
	}
	lr_end_transaction("daochu",LR_AUTO);
	return 0;
}

参数设置 

2、修改业务: 

Action()
{

	web_add_auto_header("Accept-Language", 
		"zh-CN,zh;q=0.9");

	lr_think_time(12);

	web_custom_request("list", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/paging/list?_t=1740117583061", 
		"Method=OPTIONS", 
		"Resource=0", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t137.inf", 
		"Mode=HTTP", 
		LAST);

	web_custom_request("list_2", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/paging/list?_t=1740117583061", 
		"Method=POST", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t138.inf", 
		"Mode=HTTP", 
		"EncType=application/json;charset=UTF-8", 
		"Body={\"current\":1,\"size\":10,\"productName\":\"\",\"fileCategory\":\"鍔犵儹鍣ㄥ叿浜у搧鍥剧墖\"}", 
		LAST);

	lr_think_time(13);



	web_custom_request("list_3", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/paging/list?_t=1740117597613", 
		"Method=OPTIONS", 
		"Resource=0", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t139.inf", 
		"Mode=HTTP", 
		LAST);
//Ord设置的是页面数据的第几条数据,适用于多条数据进行选择,因为是修改,所以通过查询用户名看剩余相同用户名的数据有几条判断数据是否修改成功
web_reg_save_param("Hid",
		"LB=\"id\":\"",
		"RB=\",\"batteryCapacity\":",
		"Ord={NewParam}",
		"NotFound=ERROR",
		"Search=All",
		LAST);
	web_custom_request("list_4", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/paging/list?_t=1740117597613", 
		"Method=POST", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t140.inf", 
		"Mode=HTTP", 
		"EncType=application/json;charset=UTF-8", 
		"Body={\"current\":1,\"size\":10,\"productName\":\"zhangsan\",\"fileCategory\":\"鍔犵儹鍣ㄥ叿浜у搧鍥剧墖\"}", 
		LAST);


   

//添加集合点
	lr_rendezvous("xiug");
	lr_start_transaction("xiug");



	web_custom_request("init_3", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/apply/init?businessId=821260777&_t=1740117610056", 
		"Method=OPTIONS", 
		"Resource=0", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t141.inf", 
		"Mode=HTTP", 
		LAST);


	web_url("init_4", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/apply/init?businessId=821260777&_t=1740117610056", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t142.inf", 
		"Mode=HTTP", 
		LAST);

	lr_think_time(16);

	web_custom_request("save", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/apply/save?_t=1740117626986", 
		"Method=OPTIONS", 
		"Resource=0", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t143.inf", 
		"Mode=HTTP", 
		LAST);
	web_reg_find("Fail=NotFound",
		"Search=Body",
		"SaveCount=count",
		"Text=\"code\":0,",
		LAST);
	web_custom_request("save_2", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/apply/save?_t=1740117626986", 
		"Method=POST", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t144.inf", 
		"Mode=HTTP", 
		"EncType=application/json;charset=UTF-8", 
		"BodyBinary={\"heatInstruments\":{\"id\":\"{Hid}\",\"productName\":\"xzxz\",\"heatingMode\":\"SOLAR_HEATING\",\"structure\":\"ONE_PIECE\",\"color\":\"\\xE7\\xBA\\xA2\\xE8\\x89\\xB2\",\"marketSituation\":null,\"country\":\"The_Philippines\",\"payTaxes\":\"DUTY_FREE\",\"adapterYan\":\"DOUBLE_SEVEN\",\"listedTime\":null,\"productSize\":null,\"packagingSize\":null,\"productWeight\":null,\"batterySpecification\":null,\"ratedVoltage\":null,\"batteryCapacity\":null,\"smokingNumber\":null,\""
		"chargingInterface\":null,\"chargingParams\":null,\"chargingTime\":null,\"preheatingTime\":null,\"heatingTime\":null,\"heatingTemperature\":null,\"productAccessories\":null,\"cable\":null,\"cleaningBrush\":null,\"packagingInfo\":null,\"certificationInfo\":null,\"createdBy\":\"11300146\",\"createdTime\":\"2025-02-21 09:03:40\",\"updatedBy\":\"11300146\",\"updatedTime\":\"2025-02-21 09:03:40\"},\"heatCodeInfos\":[{\"id\":\"{Hid}\",\"instrumentsId\":\"346096468\",\"countries\":\"The_Philippines\","
		"\"countryName\":\"\\xE8\\x8F\\xB2\\xE5\\xBE\\x8B\\xE5\\xAE\\xBE\",\"productCode\":\"123\",\"productType\":\"123\",\"yanSpecification\":\"123\",\"color\":\"\\xE7\\xBA\\xA2\\xE8\\x89\\xB2\",\"createdBy\":\"11300146\",\"createdTime\":\"2025-02-21 09:03:40\",\"updatedBy\":\"11300146\",\"updatedTime\":\"2025-02-21 09:03:40\"}]}", 
		LAST);

	web_custom_request("list_5", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/paging/list?_t=1740117628743", 
		"Method=OPTIONS", 
		"Resource=0", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t145.inf", 
		"Mode=HTTP", 
		LAST);

	web_custom_request("list_6", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/paging/list?_t=1740117628743", 
		"Method=POST", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t146.inf", 
		"Mode=HTTP", 
		"EncType=application/json;charset=UTF-8", 
		"Body={\"current\":1,\"size\":10,\"productName\":\"\",\"fileCategory\":\"鍔犵儹鍣ㄥ叿浜у搧鍥剧墖\"}", 
		LAST);

//	lr_end_transaction("xiug",LR_AUTO);
//检查点校验
	if(atoi(lr_eval_string("{count}")) > 0){
            lr_end_transaction("xiug", LR_PASS);
        }else{
            lr_end_transaction("xiug", LR_FAIL);
		}
	return 0;
}

页面一共十条数据并且没有办法手动选择

 3、删除业务(参考修改业务)

web_url("chunk-8662564c.ccf1619e.js", 
		"URL=http://10.157.230.156/js/chunk-8662564c.ccf1619e.js", 
		"Resource=1", 
		"RecContentType=application/javascript", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t132.inf", 
		LAST);

	web_add_header("Accept-Language", 
		"zh-CN,zh;q=0.9");

	web_url("chunk-e12aa42a.7e17fbc7.js", 
		"URL=http://10.157.230.156/js/chunk-e12aa42a.7e17fbc7.js", 
		"Resource=1", 
		"RecContentType=application/javascript", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t133.inf", 
		LAST);

	web_add_header("Accept-Language", 
		"zh-CN,zh;q=0.9");

	web_url("chunk-804e920c.afb17eb7.js", 
		"URL=http://10.157.230.156/js/chunk-804e920c.afb17eb7.js", 
		"Resource=1", 
		"RecContentType=application/javascript", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t134.inf", 
		LAST);

	web_add_header("Accept-Language", 
		"zh-CN,zh;q=0.9");

	web_url("chunk-725b65e5.d90fef3d.js", 
		"URL=http://10.157.230.156/js/chunk-725b65e5.d90fef3d.js", 
		"Resource=1", 
		"RecContentType=application/javascript", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t135.inf", 
		LAST);

	web_add_header("Accept-Language", 
		"zh-CN,zh;q=0.9");

	web_url("chunk-a053877a.b0c24155.js", 
		"URL=http://10.157.230.156/js/chunk-a053877a.b0c24155.js", 
		"Resource=1", 
		"RecContentType=application/javascript", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t136.inf", 
		LAST);

	web_concurrent_end(NULL);

	web_add_auto_header("Accept-Language", 
		"zh-CN,zh;q=0.9");

	lr_think_time(6);

	web_custom_request("list", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/paging/list?_t=1740134500762", 
		"Method=OPTIONS", 
		"Resource=0", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t137.inf", 
		"Mode=HTTP", 
		LAST);
   web_reg_save_param("Hid",
		"LB=\"id\":\"",
		"RB=\",\"batteryCapacity\":",
		"Ord={NewParam}",
		"NotFound=ERROR",
		"Search=All",
		LAST);
	web_custom_request("list_2", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/paging/list?_t=1740134500762", 
		"Method=POST", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t138.inf", 
		"Mode=HTTP", 
		"EncType=application/json;charset=UTF-8", 
		"Body={\"current\":1,\"size\":10,\"productName\":\"\",\"fileCategory\":\"鍔犵儹鍣ㄥ叿浜у搧鍥剧墖\"}", 
		LAST);
//添加集合点
	lr_rendezvous("shanchu");
	lr_start_transaction("shanchu");

	web_custom_request("delete", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/apply/delete?businessId={Hid}&_t=1740134549455", 
		"Method=OPTIONS", 
		"Resource=0", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t141.inf", 
		"Mode=HTTP", 
		LAST);

	web_url("delete_2", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/apply/delete?businessId={Hid}&_t=1740134549455", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t142.inf", 
		"Mode=HTTP", 
		LAST);

	web_custom_request("list_5", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/paging/list?_t=1740134550849", 
		"Method=OPTIONS", 
		"Resource=0", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t143.inf", 
		"Mode=HTTP", 
		LAST);
	web_reg_find("Fail=NotFound",
		"Search=Body",
		"SaveCount=count",
		"Text=\"code\":0,",
		LAST);
	web_custom_request("list_6", 
		"URL=http://10.157.230.156:8084/gczxplatform/api/heat/instruments/paging/list?_t=1740134550849", 
		"Method=POST", 
		"Resource=0", 
		"RecContentType=application/json", 
		"Referer=http://10.157.230.156/", 
		"Snapshot=t144.inf", 
		"Mode=HTTP", 
		"EncType=application/json;charset=UTF-8", 
		"Body={\"current\":1,\"size\":10,\"productName\":\"zhangsan\",\"fileCategory\":\"鍔犵儹鍣ㄥ叿浜у搧鍥剧墖\"}", 
		LAST);

//	lr_end_transaction("shanchu",LR_AUTO);
	if(atoi(lr_eval_string("{count}")) > 0){
            lr_end_transaction("shanchu", LR_PASS);
        }else{
            lr_end_transaction("shanchu", LR_FAIL);
		}

	return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

编程浪漫史

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

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

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

打赏作者

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

抵扣说明:

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

余额充值