loadRunner内部介绍以及常见问题

录制内的 Options:

接下来我们挨个看一下里面的东东以及区别

General(通常的)

  Script,不用修改,是脚本的语言,我们一般都是基于 C 语言的

  Protocols:指的是协议,我们选的就是 HTTP 协议

  Recording

    HTML-based script(初学者用这个)——会把请求汇总,脚本会简介一些

    URL-based script(做熟了之后用这个)——每一个 URL 是一个单独请求,请求会有很多,详细

  HTML-based script 内的 Tree 视图只有一个请求:

  脚本如下:

Action()
{

    web_url("www.baidu.com", 
        "URL=http://www.baidu.com/", 
        "TargetFrame=", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=", 
        "Snapshot=t6.inf", 
        "Mode=HTML", 
        LAST);

    web_url("百度首页", 
        "URL=https://www.baidu.com/", 
        "TargetFrame=", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=", 
        "Snapshot=t7.inf", 
        "Mode=HTML", 
        LAST);

    web_url("s", 
        "URL=https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&ch=&tn=baidu&bar=&wd=besttest&rn=&oq=&rsv_pq=c34d645c0000bb68&rsv_t=0711mCQaaJ6hz3rDFU%2F%2B9IPRvD6ZKJcDhsyfKpcU8ELD5ZdB041RJFCccAA&rqlang=cn", 
        "TargetFrame=", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=https://www.baidu.com/", 
        "Snapshot=t10.inf", 
        "Mode=HTML", 
        LAST);

    web_url("s_2", 
        "URL=https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&ch=&tn=baidu&bar=&wd=besttest&rn=&oq=&rsv_pq=c34d645c0000bb68&rsv_t=0711mCQaaJ6hz3rDFU%2F%2B9IPRvD6ZKJcDhsyfKpcU8ELD5ZdB041RJFCccAA&rqlang=cn", 
        "TargetFrame=", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=https://www.baidu.com/", 
        "Snapshot=t11.inf", 
        "Mode=HTML", 
        EXTRARES, 
        "Url=/aladdin/tpl/right_toplist1/refresh.png", "Referer=https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&ch=&tn=baidu&bar=&wd=besttest&rn=&oq=&rsv_pq=c34d645c0000bb68&rsv_t=0711mCQaaJ6hz3rDFU%2F%2B9IPRvD6ZKJcDhsyfKpcU8ELD5ZdB041RJFCccAA&rqlang=cn", ENDITEM, 
        LAST);

    return 0;
}
HTML-based script

 HTML-based script 内部也有可选的:

  这里注意不要选择 web_link 做脚本,要用web_url,也就是选第二个,为什么呢?

    web_link会有个什么过程呢,比如我们在淘宝内点商品的"详情",是显示点击"详情",再 link 到"详情"的 url 地址上。如果 link 的对象是个乱码,大概率找不到

    web_url 是直接点击"详情"url ,链接过去,也就是相当于效率更高,少了中间的跳转过程。

  URL-based scripts 内的 Tree 视图,详细点

  脚本内,图片之类的也会作为一个请求

Action()
{
    web_url("www.baidu.com", 
        "URL=http://www.baidu.com/", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=", 
        "Snapshot=t16.inf", 
        "Mode=HTTP", 
        LAST);

    web_url("百度首页", 
        "URL=https://www.baidu.com/", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=", 
        "Snapshot=t17.inf", 
        "Mode=HTTP", 
        LAST);

    web_concurrent_start(NULL);

    web_url("baidu_jgylogo3.gif", 
        "URL=https://www.baidu.com/img/baidu_jgylogo3.gif", 
        "Resource=1", 
        "RecContentType=image/gif", 
        "Referer=https://www.baidu.com/", 
        "Snapshot=t18.inf", 
        LAST);

    web_url("baidu_jgylogo3.gif_2", 
        "URL=https://www.baidu.com/img/baidu_jgylogo3.gif", 
        "Resource=1", 
        "RecContentType=image/gif", 
        "Referer=https://www.baidu.com/", 
        "Snapshot=t19.inf", 
        LAST);

    web_url("bd_logo1.png", 
        "URL=https://www.baidu.com/img/bd_logo1.png?qua=high", 
        "Resource=1", 
        "RecContentType=image/png", 
        "Referer=https://www.baidu.com/", 
        "Snapshot=t20.inf", 
        LAST);

    web_url("bd_logo1.png_2", 
        "URL=https://www.baidu.com/img/bd_logo1.png", 
        "Resource=1", 
        "RecContentType=image/png", 
        "Referer=https://www.baidu.com/", 
        "Snapshot=t21.inf", 
        LAST);

    web_concurrent_end(NULL);

    web_url("bd_logo1.png_3", 
        "URL=https://www.baidu.com/img/bd_logo1.png?qua=high", 
        "Resource=1", 
        "RecContentType=image/png", 
        "Referer=https://www.baidu.com/", 
        "Snapshot=t22.inf", 
        LAST);

    web_custom_request("wup.browser.qq.com_5", 
        "URL=https://wup.browser.qq.com/", 
        "Method=POST", 
        "Resource=0", 
        "RecContentType=application/multipart-formdata", 
        "Referer=", 
        "Snapshot=t23.inf", 
        "Mode=HTTP", 
        "EncType=", 
        "BodyBinary=\\x00\\x00\\x01&\\x10\\x02,<LV\\x0Bqbcloudctrlf\tsetStatus}\\x00\\x01\\x00\\xFB\\x08\\x00\\x01\\x06\\x04info\\x18\\x00\\x01\\x06\rQB.StatusInfo\\x1D\\x00\\x01\\x00\\xDB\n\\x06 06af66d5bcf977fdbca23e395e73c51e\\x16 06af66d5bcf977fdbca23e395e73c51e \\x129\\x00\\x02\n\\x01Z:\\x10O)\\x00\\x01\n\\x0C\\x1C,0\\x0BA'\\x11]\\x00\\x0Cf\\x00p\\x01\\x0B\\x0B\n\\x01Z:\\x10O)\\x00\\x01\n\\x0C\\x1C,0\\x0BA'\\x11]\\x00\\x0Cf\\x00p\\x01\\x0B\\x0BF\\x071.0.0.0\\\\f\\x00p\t"
        "\\x86\\x056.1.1怈\\xA0\\x12\\xB0\t\\xC6\\x00苕\\x00\\xFC\\x0F\\xFC\\x10\\xF6\\x11\\x00\\xF0\\x12\\xFF\\xF0\\x13\\xFF\\xF0\\x14\\xFF\\xF6\\x15\\x00\\xFC\\x16\\xFC\\x17\\xFC\\x18\\xFC\\x19\\xF6\\x1A\\x00\\xF6\\x1B\\x00\\xFC\\x1C\\xFC\\x1D\\xFC\\x1E\\xFC\\x1F\\xF6 \\x0E6.1.7601.17514\\x0B寴\\x0C\\xA8\\x0C", 
        LAST);

    web_url("bd_logo1.png_4", 
        "URL=https://www.baidu.com/img/bd_logo1.png", 
        "Resource=1", 
        "RecContentType=image/png", 
        "Referer=https://www.baidu.com/", 
        "Snapshot=t24.inf", 
        LAST);

    web_custom_request("wup.browser.qq.com_6", 
        "URL=https://wup.browser.qq.com/", 
        "Method=POST", 
        "Resource=0", 
        "RecContentType=application/multipart-formdata", 
        "Referer=", 
        "Snapshot=t25.inf", 
        "Mode=HTTP", 
        "EncType=", 
        "BodyBinary=\\x00\\x00\\x01&\\x10\\x02,<LV\\x0Bqbcloudctrlf\tsetStatus}\\x00\\x01\\x00\\xFB\\x08\\x00\\x01\\x06\\x04info\\x18\\x00\\x01\\x06\rQB.StatusInfo\\x1D\\x00\\x01\\x00\\xDB\n\\x06 06af66d5bcf977fdbca23e395e73c51e\\x16 06af66d5bcf977fdbca23e395e73c51e \\x129\\x00\\x02\n\\x01Z:\\x10O)\\x00\\x01\n\\x0C\\x1C,0\\x0BA'\\x11]\\x00\\x0Cf\\x00p\\x01\\x0B\\x0B\n\\x01Z:\\x10O)\\x00\\x01\n\\x0C\\x1C,0\\x0BA'\\x11]\\x00\\x0Cf\\x00p\\x01\\x0B\\x0BF\\x071.0.0.0\\\\f\\x00p\t"
        "\\x86\\x056.1.1怈\\xA0\\x12\\xB0\t\\xC6\\x00苕\\x00\\xFC\\x0F\\xFC\\x10\\xF6\\x11\\x00\\xF0\\x12\\xFF\\xF0\\x13\\xFF\\xF0\\x14\\xFF\\xF6\\x15\\x00\\xFC\\x16\\xFC\\x17\\xFC\\x18\\xFC\\x19\\xF6\\x1A\\x00\\xF6\\x1B\\x00\\xFC\\x1C\\xFC\\x1D\\xFC\\x1E\\xFC\\x1F\\xF6 \\x0E6.1.7601.17514\\x0B寴\\x0C\\xA8\\x0C", 
        LAST);

    lr_think_time(4);

    web_url("s", 
        "URL=https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&ch=&tn=baidu&bar=&wd=besttest&rn=&oq=&rsv_pq=c98662740000cd91&rsv_t=bdadbVHsYjtsVORU8UBw9%2F95s5P5XfStOtdF%2BBGRtJVUEwNj1gxvd3Jqe1A&rqlang=cn", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=https://www.baidu.com/", 
        "Snapshot=t26.inf", 
        "Mode=HTTP", 
        LAST);

    web_url("s_2", 
        "URL=https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&ch=&tn=baidu&bar=&wd=besttest&rn=&oq=&rsv_pq=c98662740000cd91&rsv_t=bdadbVHsYjtsVORU8UBw9%2F95s5P5XfStOtdF%2BBGRtJVUEwNj1gxvd3Jqe1A&rqlang=cn", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=https://www.baidu.com/", 
        "Snapshot=t27.inf", 
        "Mode=HTTP", 
        LAST);

    web_url("bd_logo1.png_5", 
        "URL=https://www.baidu.com/img/bd_logo1.png", 
        "Resource=1", 
        "RecContentType=image/png", 
        "Referer=https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&ch=&tn=baidu&bar=&wd=besttest&rn=&oq=&rsv_pq=c98662740000cd91&rsv_t=bdadbVHsYjtsVORU8UBw9%2F95s5P5XfStOtdF%2BBGRtJVUEwNj1gxvd3Jqe1A&rqlang=cn", 
        "Snapshot=t28.inf", 
        LAST);

    return 0;
}
URL-based script

   URL-based script,依照默认的无需修改

Data Formate Extension(不需要管的东西)

Network

  Port Mapping(代理录制的设置)

HTTP Properties(HTTP参数)

  Advanced  勾选 UTF-8 ,解决的是脚本的乱码,解决请求乱码,不能解决 Response 乱码

猜你喜欢

转载自www.cnblogs.com/xiaowenshu/p/10337062.html