博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
loadrunner模拟文件上传代码示例
阅读量:6671 次
发布时间:2019-06-25

本文共 2004 字,大约阅读时间需要 6 分钟。

hot3.png

Action(){    long file_stream;    char * PRPFILE =  "F:\\ELIFE保单号.txt";	  char * num;    char * PRPNum;	  char * IP;	  num = lr_eval_string("{num}");	  IP = lr_get_vuser_ip();	lr_start_transaction("elife-环球游-团单-团单导入上传");	web_submit_data("commonUpload.do",		"Action=http://11.207.60.3:8001/elife/policy/commonUploadAction/commonUpload.do",		"Method=POST",		"EncType=multipart/form-data",		"RecContentType=text/html",		"Referer=http://11.207.60.3:8001/elife/uploade.jsp",		"Snapshot=t16.inf",		"Mode=HTML",		ITEMDATA,//		"Name=sessionid", "Value=JS32100001EAJ1363727{CorrelationParameter_3}13031916{CorrelationParameter_4}", ENDITEM,		"Name=sessionid", "Value=JS32100001EAJ{CorrelationParameter_4}", ENDITEM,		"Name=uploadFile", "Value=E:\\elifetdimport.xls", "File=yes", ENDITEM,		LAST);	lr_output_message("session id: %s",lr_eval_string("{CorrelationParameter_4}"));	lr_end_transaction("elife-环球游-团单-团单导入上传", LR_AUTO);	lr_start_transaction("获取保单号");	web_submit_data("qingfenAction.do",		"Action=http://11.207.60.3:8001/elife/elife/QingfenAction/qingfenAction.do",		"Method=POST",		"Referer=http://11.207.60.3:8001/elife/policy/eAJPolicyAction/addEAJpolicy.do",		"Mode=HTML",		ITEMDATA,		"Name=proposalnos", "Value={CorrelationParameter_2}", ENDITEM,		"Name=next", "Value=0.0075899769244481274", ENDITEM,		LAST);	if(strcmp(lr_eval_string("{CorrelationParameter_2}")," ")!=0){		lr_end_transaction("获取保单号", LR_PASS);		PRPNum = lr_eval_string("{CorrelationParameter_2}");		lr_log_message(" ---------------保单号:%s----------------",PRPNum);			  if ((file_stream = fopen(PRPFILE, "a+")) == NULL ) {		  lr_error_message("Cannot open %s", PRPFILE);		  return -1;		 }		 fprintf(file_stream, "保单号:%s      发生在第%s次运行时    本机IP:%s\n", PRPNum,num,IP);		 fclose(file_stream);		 lr_log_message(" ---------------导出保单号:%s 成功,位置:%s----------------",PRPNum,PRPFILE);	}else{		lr_log_message("--------------获取保单号失败!-----------");		lr_end_transaction("获取保单号", LR_FAIL);	}return 0;}

 

转载于:https://my.oschina.net/u/2391658/blog/693903

你可能感兴趣的文章