LoadRunner性能测试,下载文件脚本

Loadrunner

操作()

{

intflen;//

longfiledes;//

charfile [256]=" \ 0”;//

inttime;

//, 1 mb

web_set_max_html_param_len (“1024000”);

//

web_reg_save_param_ex (

" ParamName=filecontent ",

"磅=",

" RB=",

SEARCH_FILTERS,

"范围=身体”,

" RequestUrl=http://10.255.0.145/download.php?用户id={userId} &bigmd5={userId}抵消=0”,

);

//

lr_start_transaction(“下载”);

web_url(“下载”,

" URL=http://10.255.0.145/download.php?用户id={userId} &bigmd5={userId}抵消=0”,

资源=1”,

" RecContentType=应用程序/八进制",

"推荐人=",

最后);

lr_end_transaction(“下载”,LR_AUTO);

/* web_get_int_propertyhttpHTTP_INFO_DOWNLOAD_SIZE HTTP_INFO_DOWNLOAD_TIME, HTTP_INFO_RETURN_CODE */

flen=web_get_int_property (HTTP_INFO_DOWNLOAD_SIZE);

lr_output_message (”: % d”, flen);

时间=web_get_int_property (HTTP_INFO_DOWNLOAD_TIME);

lr_output_message (”: % d”,时间),

//E: \ \ FSDownload \ \ % d。txtfile

sprintf(文件,“E: \ \ FSDownload \ \ % d.txt”,兰德());

lr_output_message (“: % s文件),

如果(flen> 0) {

如果((提起=fopen(文件,“世界银行”))==NULL) {

lr_output_message (“OpenFile失败!”lr_eval_string (" {filecontent} "));

返回1;

}

//filecontentfiledesflen1

写入文件(lr_eval_string (“{filecontent}”), flen, 1,提交),

文件关闭(提起);

}

return0;

}


LoadRunner性能测试,下载文件脚本