使用post上传的lr脚本

2013-07-28  张瑞刚 


/********************************定义double类型的变量trans_time,用来保存事务的执行时间。*/
              double trans_time;
/************************************定义int类型的变量status,用来保存事务执行的返回的值。*/

               int status;
                     lr_start_transaction("file1");
/**********************使用内置函数lr_get_transaction_duration获取事务的执行时间。*/ 
                       trans_time=lr_get_transaction_duration("file1");
/**************************************************************上传文件*/
                       status=  web_submit_data("uploadfile1",    
                                    "Action=http://172.16.26.205:9000/upload",
                                    "Method=POST",  
                                    "EncType=multipart/form-data",
                                    "RecContentType=text/html",
                                     "Referer=http://172.16.26.205:9000/upload",
                                     "Snapshot=t12.inf",
                                    "Mode=HTTP", 
                                     ITEMDATA,
                                          "Name=uploadFile",
                                          "Value=E://a.pdf", 
                                             "File=yes", ENDITEM,
                                     LAST);
        /***************增加手工事务,如果该测试事务执行返回值为0,则事务执行成功,否则执行失败。*/
                   if (status == 0)
                          lr_end_transaction("file1", LR_PASS);
                   else 
                          lr_end_transaction("file1", LR_FAIL);
         //*************************************************打印事务执行时间。
                if (trans_time)
                      lr_output_message("事务执行时间为:%f 秒",trans_time);   
                 else
                   lr_output_message("事务执行时间未知!");

435°/4350 人阅读/0 条评论 发表评论

登录 后发表评论