?????????LoadRunner 11???????????????WEB???????????
??????????????????£???????????????????????????????????Get / Post????????????ж????????????????????????
??????????Action??????????·???????????????£???????????????????????LoadRunner???????????
????1. web_reg_save_param
????????????????????????????????????в??????????????????????????????????????????????(??web_url)??????С?
????????
????int web_reg_save_param(const char *ParamName?? <list of Attributes>?? LAST);
???????????:
????1) ParamName: ?????????????????????
????2) LB??RB (???)????????????/????????
???????
????1) web_reg_save_param?????????????????????????????????????????????
????2) ??????????????256???????????256????????int web_set_max_html_param_len (const char *length )??????????????淶Χ??
?????磺web_set_max_html_param_len (1024); //??????????淶Χ?1024???
????3) LB??RB???????"/ic"???????Сд?????(???????????Сд???)
?????磺web_reg_save_param("IsRight"??"LB/ic=cache-control: private "??"RB/ic=|"??LAST);
????2. web_url
????????Http GET???????????????????????url???????
????3. web_submit_data
????WEB?????????????????????????GET??POST??????????URL??????????(POST/GET)???????????????????
????4. ????л???lr_start_transaction???????ж????????lr_end_transaction pass??fail????÷??????????????
??????????????£?
Action()
{
lr_start_transaction("TestGet");
web_reg_save_param("TGCode"??
"LB/IC={"returnCode":""??
"RB/IC="??""??
LAST);
web_url("TestGet"??
"URL=http://192.168.1.1:8080/GetPage"??
"Resource=0"??
"RecContentType=text/html"??
"Mode=HTML"??
LAST);
if((strstr(lr_eval_string("{TGCode}")??"0000"))==NULL)
{
lr_end_transaction("TestGet"?? LR_FAIL);
lr_error_message("TestGet Failed! ReturnCode:%s"??lr_eval_string ("{TGCode}"));
}
else
{
lr_end_transaction("TestGet"?? LR_PASS);
lr_output_message("TestGet Sucess! ReturnCode:%s"??lr_eval_string ("{TGCode}"));
}
lr_start_transaction("TestPost");
web_reg_save_param("TPCode"??
"LB/IC={"returnCode":""??
"RB/IC="??""??
LAST);
web_submit_data("TestPost"??
"Action=http://192.168.1.1:8080/TestPost"??
"Method=POST"??
"RecContentType=text/html"??
"Mode=HTML"??
ITEMDATA??
"Name=param1"?? "Value=param1"?? ENDITEM??
"Name=param2"?? "Value=param2"?? ENDITEM??
LAST);
if((strstr(lr_eval_string("{TPCode}")??"0000"))==NULL)
{
lr_end_transaction("TestPost"?? LR_FAIL);
lr_error_message("TestPost Failed!ReturnCode: %s"??lr_eval_string ("{TPCode}"));
}
else
{
lr_end_transaction("TestPost"?? LR_PASS);
lr_output_message("TestPost Sucess! ReturnCode: %s"??lr_eval_string ("{TPCode}"));
}
return 0;
}