zoukankan      html  css  js  c++  java
  • 其他函数-web_get_int_property

    用于记录http响应的信息。这个函数在调试脚本的常用,但是在实际压力测试中请将这些注释

    使用这个函数可以获取到的信息有:
    
    1、HTTP_INFO_RETURN_CODE:返回HTTP响应码
    
    2、HTTP_INFO_DOWNLOAD_SIZE:返回页面字节数
    
    3、HTTP_INFO_DOWNLOAD_TIME:返回页面下载的时间
    Action()
    
    {
    
    int nHttpRetCode;
    
    int nHttpDownloadSize;
    
    int nHttpDownloadTime;
    
    web_set_max_html_param_len("44700"); // 默认最大长度为256
    
    web_url("try",
    
     "URL={url地址}",
    
     "Resource=0",
    
     "RecContentType=text/html",
    
     "Referer=",
    
    "Mode=HTTP",
    
    LAST);
    
    nHttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);
    
    nHttpDownloadSize=web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);
    
    nHttpDownloadTime=web_get_int_property(HTTP_INFO_DOWNLOAD_TIME);
    
    lr_output_message("HTTP Code:%d
    ",nHttpRetCode);
    
    lr_output_message("Download Size:%d
    ",nHttpDownloadSize);
    
    lr_output_message("Download Time:%d",nHttpDownloadTime);
    
    
    return 0;
    
    }
    Action()
    {
        int size;
        int code;
        
        
     
        
        web_add_header("pid","{pi}");
        lr_output_message("%s",lr_eval_string("{pi}"));
        
        web_add_header("Content-Type","application/json");
        
        lr_think_time(2);
        lr_start_transaction("请求");
     
        lr_start_transaction("业务请求");
     
        web_custom_request("web_custom_request",
            "URL=https://app.xxxxx/xqAppServer/api/APPBizRest/queryCoupons/v1/",
            "Method=POST",
            "TargetFrame=",
            "Resource=0",
            "Referer=",
            "Mode=HTTP",
            /* json和键值对数据格式,建议使用web_add_header方法添加Content-Type头 */
            //"EncType=application/json",
            "Body={"aesRequest": "{data}"}",
            LAST);
        code=web_get_int_property(HTTP_INFO_RETURN_CODE);
        size=web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);
        
        if(code==200)
        {
            lr_log_message("请求成功");
            lr_end_transaction("请求", LR_PASS);
     
            
            if(size>5000)
            {
                    lr_end_transaction("业务请求", LR_PASS);
            lr_log_message("业务处理成功");
            }
            else
            {
                lr_error_message("业务处理失败:size=%d",size);
                lr_end_transaction("业务请求", LR_FAIL);
            }
        }
        else
        {
            lr_error_message("请求失败");
            lr_end_transaction("请求", LR_FAIL);
        }
        
     
        return 0;
    }
     
  • 相关阅读:
    呵呵,今天偶然看到了我最早期的商业网站作品
    轻量级的Ajax解决方案——DynAjax:直接在客户端调用C#类的方法
    RegexDesigner.NET 正则表达式开源工具
    Asp.net页面的生命周期之通俗理解
    我设计的公司网站主页 截图
    没想到裴勇俊留了一头长发。
    一个very好的Javascript ajax库,jQuery!
    JQuery资源收集
    收藏:悟透JavaScript
    VS2008 F5不能调试情况一例
  • 原文地址:https://www.cnblogs.com/lvchengda/p/12626088.html
Copyright © 2011-2022 走看看