LoadRunner-使用web_get_int_property进行文件下载

一、web_get_int_property函数
1、函数用途
记录http响应的信息
2、函数属性
1)HTTP_INFO_RETURN_CODE:        返回http代码
2)HTTP_INFO_DOWNLOAD_SIZE:    返回页面字节数
3)HTTP_INFO_DOWNLOAD_TIME:    返回页面下载时间

二、web_reg_save_param函数
1、函数用途
关联函数,保存文件下载信息

Action()
{
	long flen;      //文件大小
    long lfbody;  //响应数据内容大小
    int HttpRetCode; //HTTP返回码

	//保存文件句柄
	web_set_max_html_param_len("1024000");
	
	lr_rendezvous("download");
	lr_start_transaction("download");


	web_url("download",
			"URL=http://192.168.17.39:8080/MDMServer/public/api/client/v1/appdownload.do?id=1711402&tenantName=saasdb1",
			"Resource=1",
			"RecContentType=application/x-msdownload",
			"Mode=HTTP", 
			"Referer=",
			LAST);
	
	// //返回200,表示成功
	 HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);
     if (HttpRetCode == 200)
        lr_output_message("The script. successfully accessed the page");
    else
        lr_error_message("The script. failed to access the page ");
	
	
	
		//获取响应中的文件长度
	flen = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);

	if(flen > 4805596)
		lr_end_transaction("download", LR_PASS);
	else
		lr_end_transaction("download", LR_FAIL);
		
    return 0;
}




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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值