loadrunner http协议psot脚本

由于工作原因要编写一个http post方式的脚本 使用的是http的协议,脚本如下:

/****************************************
* created on 2012-08-06 *
* created by haoyunpeng *
*****************************************/
int HttpCe;
Action()

{  
//加个头文件,用来说明使用的方法
   web_add_auto_header("Content-Type","application/json");
   
lr_start_transaction("interface");

   web_custom_request("ListThemes",

                       "URL=http://xxxx.xxxxxx.com/synth/open/listThemes.do",

                       "Method=POST",

                       "Resource=0",

                        "RecContentType=application/json",

                      "Referer=",                      

                      "Body={\"imei\":null,\"themelist\":[{\"local\":null,\"start\":\"1\",\"count\":\"3\",\"type\":\"0\",\"font\":null,\"screen\":[\"hdpi\"],\"lock\":[\"403\"]}],\"imsi\":null,\"version\":null,\"model\":null,\"test\":\"false\"}",

                      "TargetFrame=",

                       LAST);
   
lr_end_transaction("interface", LR_AUTO);


//获取返回web_url中的页面的http代码
//HttpCe = web_get_int_property(HTTP_INFO_RETURN_CODE);
     //lr_output_message("返回的http代码:%d",HttpCe);


       //判断页面返回正确与否

       if(web_get_int_property(HTTP_INFO_RETURN_CODE)==200)  //开发确认或通过函数获取

              lr_output_message("OK!!");

       else

              lr_error_message("Fail!!");

       return 0;

}

你可能感兴趣的:(http,post,loadrunner)