使用loadrunner进行性能测试(四)--检查点设置

本文介绍了如何在LoadRunner中通过HTTP返回码进行性能测试的校验。通过使用web_get_int_property函数获取HTTP_INFO_RETURN_CODE,确保每次HTTP请求的正确性。强调了在定义变量时需置于最前方以避免错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  • http请求通过返回码进行校验。使用函数
    HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);
    注意loadrunner中变量定义必须放在最前面,否则会报错。

action{
	int HttpRetCode; 
	web_url("login",
		"URL=http://www.163.com",
		"Resource=0",
		"RecContentType=text/html",
		"Referer=",
		"Snapshot=t1.inf",
		"Mode=HTML",
		LAST);


    HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);


    lr_output_message( "HTTP_INFO_RETURN_CODE %d",HttpRetCode); 


	//Check HttpRetCode


    if (HttpRetCode == 200) {


       lr_log_message("The script successfully accessed the login page");


	   }
    else {


       lr_log_message("The script failed to access the login page "); 


	   }
}


通过跳转页面的内容进行校验。
           使用web_reg_find函数。
           遇到需要用中文校验时,有两种方法解决:一是设置录制时的格式为utf-8;二是通过lr_convert_string_encoding 函数转化需要校验的内容格式。



Action()
{ 
  
    lr_start_transaction("tv
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值