andycai 发表于 2009-7-1 15:11:17

LR的高级页面设置问题

请教大家,在录制脚本前设置lR的recording功能中的HTML-base script,设置页面如下:

如上图中的script type中的两个选项,请问有什么区别?什么时候该选择哪个选项?烦请各位解答?

andycai 发表于 2009-7-7 10:12:59

回复 1# 的帖子

自己顶一下,请知道的人帮忙解答?

marco 发表于 2009-7-7 11:55:27

以下是我自己用不同模式做的实验,lz可以看下
#include "web_api.h"
//HTML-based script
//Script type: A script describing user &actions (e.g. web_link, web_submit_form)
//Non HTML-generated elements (e.g. JavaScript, VBScript, ActiveX, Applets): Record within the &current script step

Action()
{
        web_url("192.168.7.178",
                "URL=http://192.168.7.178/",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                LAST);

        lr_think_time( 13 );

        web_add_cookie("stylesheet=; DOMAIN=192.168.7.178");

        web_submit_data("login.jsp",
                "Action=http://192.168.7.178/icp/login.jsp",
                "Method=POST",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/portal/",
                "Snapshot=t2.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=username", "Value=test1", ENDITEM,
                "Name=domainname", "Value=test.com", ENDITEM,
                "Name=password", "Value=111111", ENDITEM,
                "Name=number", "Value=1", ENDITEM,
                "Name=x", "Value=14", ENDITEM,
                "Name=y", "Value=25", ENDITEM,
                EXTRARES,
                "Url=js/for_png.js", "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=aJwnoMoMQXOa8k3VimzmWF0cVsL5pGJw&view=null", ENDITEM,
                LAST);

        return 0;
}

marco 发表于 2009-7-7 11:55:49

#include "web_api.h"
//HTML-based script
//Script type: A script containing &explicit URLs only (e.g. web_url, web_submit_data)
//Non HTML-generated elements (e.g. JavaScript, VBScript, ActiveX, Applets): Record in separate &steps and use concurrent groups

Action()
{
        web_add_cookie("stylesheet=; DOMAIN=192.168.7.178");

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

        lr_think_time( 6 );

        web_submit_data("login.jsp",
                "Action=http://192.168.7.178/icp/login.jsp",
                "Method=POST",
                "TargetFrame=",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/portal/",
                "Snapshot=t2.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=username", "Value=test1", ENDITEM,
                "Name=domainname", "Value=test.com", ENDITEM,
                "Name=password", "Value=111111", ENDITEM,
                "Name=number", "Value=1", ENDITEM,
                "Name=x", "Value=16", ENDITEM,
                "Name=y", "Value=28", ENDITEM,
                LAST);

        web_url("for_png.js",
                "URL=http://192.168.7.178/icp/js/for_png.js",
                "TargetFrame=",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=KsSnoCLCaXO9eAmgQ373J873ylpIiywy&view=null",
                LAST);

        return 0;
}


#include "web_api.h"
//HTML-based script
//Script type: A script describing user &actions (e.g. web_link, web_submit_form)
//Non HTML-generated elements (e.g. JavaScript, VBScript, ActiveX, Applets): &Do not record

Action()
{
        web_add_cookie("stylesheet=; DOMAIN=192.168.7.178");

        web_url("192.168.7.178",
                "URL=http://192.168.7.178/",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                LAST);

        lr_think_time( 9 );

        web_submit_data("login.jsp",
                "Action=http://192.168.7.178/icp/login.jsp",
                "Method=POST",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/portal/",
                "Snapshot=t2.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=username", "Value=test1", ENDITEM,
                "Name=domainname", "Value=test.com", ENDITEM,
                "Name=password", "Value=111111", ENDITEM,
                "Name=number", "Value=1", ENDITEM,
                "Name=x", "Value=12", ENDITEM,
                "Name=y", "Value=19", ENDITEM,
                LAST);

        return 0;
}

marco 发表于 2009-7-7 11:56:44

#include "web_api.h"
//URL-based script
//以下选项全选
//Create concurrent &groups for resources after their source HTML page
//&Enable cache (do not suppress the IF-Modified-Since header)
   //&Clear cache before recording (Microsoft Internet Explorer only)
//Use &web_custom_request only

Action()
{
        web_add_cookie("stylesheet=; DOMAIN=192.168.7.178");

        web_custom_request("192.168.7.178",
                "URL=http://192.168.7.178/",
                "Method=GET",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTTP",
                LAST);

        lr_think_time( 5 );

        web_custom_request("login.jsp",
                "URL=http://192.168.7.178/icp/login.jsp",
                "Method=POST",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/portal/",
                "Snapshot=t2.inf",
                "Mode=HTTP",
                "Body=username=test1&domainname=test.com&password=111111&number=1&x=11&y=17",
                LAST);

        web_concurrent_start(NULL);

        web_custom_request("activeobject.jsp",
                "URL=http://192.168.7.178/wfs/activeobject.jsp",
                "Method=GET",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/icp/main_frame.jsp?domainname=test.com&sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&view=",
                "Snapshot=t3.inf",
                "Mode=HTTP",
                LAST);

        web_custom_request("main.jsp",
                "URL=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&view=null",
                "Method=GET",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/icp/main_frame.jsp?domainname=test.com&sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&view=",
                "Snapshot=t4.inf",
                "Mode=HTTP",
                LAST);

        web_concurrent_end(NULL);

        web_custom_request("ResumeUploadModule.js",
                "URL=http://192.168.7.178/wfs/js/ResumeUploadModule.js",
                "Method=GET",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/wfs/activeobject.jsp",
                LAST);

        web_concurrent_start(NULL);

        web_custom_request("index.js",
                "URL=http://192.168.7.178/icp/js/index.js",
                "Method=GET",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&view=null",
                LAST);

        web_custom_request("style1.css",
                "URL=http://192.168.7.178/icp/css/style1.css",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&view=null",
                LAST);

        web_custom_request("loading_index.js",
                "URL=http://192.168.7.178/icp/js/loading_index.js",
                "Method=GET",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&view=null",
                LAST);

        web_custom_request("left.jsp",
                "URL=http://192.168.7.178/icp/left.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                "Method=GET",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&view=null",
                "Snapshot=t5.inf",
                "Mode=HTTP",
                LAST);

        web_custom_request("view.jsp",
                "URL=http://192.168.7.178/icp/view.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                "Method=GET",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&view=null",
                "Snapshot=t6.inf",
                "Mode=HTTP",
                LAST);

        web_custom_request("test_com.css",
                "URL=http://192.168.7.178/icp/css/test_com.css",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_custom_request("mend.css",
                "URL=http://192.168.7.178/icp/css/mend.css",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/left.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_custom_request("style1.css_2",
                "URL=http://192.168.7.178/icp/css/style1.css",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/left.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_concurrent_end(NULL);

        web_custom_request("for_png.js",
                "URL=http://192.168.7.178/icp/js/for_png.js",
                "Method=GET",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&view=null",
                LAST);

        web_concurrent_start(NULL);

        web_custom_request("index.js_2",
                "URL=http://192.168.7.178/icp/js/index.js",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_custom_request("quota_info.jsp",
                "URL=http://192.168.7.178/icp/quota_info.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD",
                "Method=GET",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/icp/left.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                "Snapshot=t7.inf",
                "Mode=HTTP",
                LAST);

        web_custom_request("index.js_3",
                "URL=http://192.168.7.178/icp/js/index.js",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/quota_info.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD",
                LAST);

        web_concurrent_end(NULL);

        web_concurrent_start(NULL);

        web_custom_request("popreceive.js",
                "URL=http://192.168.7.178/icp/js/popreceive.js",
                "Method=GET",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_custom_request("loading_right.js",
                "URL=http://192.168.7.178/icp/js/loading_right.js",
                "Method=GET",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_concurrent_end(NULL);

        web_custom_request("common.css",
                "URL=http://192.168.7.178/icp/css/common.css",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/quota_info.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD",
                LAST);

        web_concurrent_start(NULL);

        web_custom_request("ico1.gif",
                "URL=http://192.168.7.178/icp/img/style1/ico1.gif",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_custom_request("xbg1.gif",
                "URL=http://192.168.7.178/icp/img/style1/xbg1.gif",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_custom_request("xbg1.gif_2",
                "URL=http://192.168.7.178/icp/img/style1/xbg1.gif",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_custom_request("xbg1.gif_3",
                "URL=http://192.168.7.178/icp/img/style1/xbg1.gif",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_custom_request("xbg1.gif_4",
                "URL=http://192.168.7.178/icp/img/style1/xbg1.gif",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_custom_request("xbg1.gif_5",
                "URL=http://192.168.7.178/icp/img/style1/xbg1.gif",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_custom_request("xbg1.gif_6",
                "URL=http://192.168.7.178/icp/img/style1/xbg1.gif",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_custom_request("loading.gif",
                "URL=http://192.168.7.178/icp/img/loading.gif",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&domainname=test.com",
                LAST);

        web_custom_request("loading.gif_2",
                "URL=http://192.168.7.178/icp/img/loading.gif",
                "Method=GET",
                "Resource=1",
                "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=Ku1xPxPxQX0QDIcViXzXs8bmprtR7QDD&view=null",
                LAST);

        web_concurrent_end(NULL);

        return 0;
}

marco 发表于 2009-7-7 11:57:00

#include "web_api.h"
//URL-based script
//以下选项都不选
//Create concurrent &groups for resources after their source HTML page
//&Enable cache (do not suppress the IF-Modified-Since header)
   //&Clear cache before recording (Microsoft Internet Explorer only)
//Use &web_custom_request only

Action()
{
        web_add_cookie("stylesheet=; DOMAIN=192.168.7.178");

        web_url("192.168.7.178",
                "URL=http://192.168.7.178/",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTTP",
                LAST);

        lr_think_time( 16 );

        web_submit_data("login.jsp",
                "Action=http://192.168.7.178/icp/login.jsp",
                "Method=POST",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/portal/",
                "Snapshot=t2.inf",
                "Mode=HTTP",
                ITEMDATA,
                "Name=username", "Value=test1", ENDITEM,
                "Name=domainname", "Value=test.com", ENDITEM,
                "Name=password", "Value=111111", ENDITEM,
                "Name=number", "Value=1", ENDITEM,
                "Name=x", "Value=27", ENDITEM,
                "Name=y", "Value=21", ENDITEM,
                LAST);

        web_url("activeobject.jsp",
                "URL=http://192.168.7.178/wfs/activeobject.jsp",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/icp/main_frame.jsp?domainname=test.com&sid=9JwnLnLnimla84XFam73shym7TqyjDsi&view=",
                "Snapshot=t3.inf",
                "Mode=HTTP",
                LAST);

        web_url("main.jsp",
                "URL=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=9JwnLnLnimla84XFam73shym7TqyjDsi&view=null",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/icp/main_frame.jsp?domainname=test.com&sid=9JwnLnLnimla84XFam73shym7TqyjDsi&view=",
                "Snapshot=t4.inf",
                "Mode=HTTP",
                LAST);

        web_url("ResumeUploadModule.js",
                "URL=http://192.168.7.178/wfs/js/ResumeUploadModule.js",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/wfs/activeobject.jsp",
                LAST);

        web_url("index.js",
                "URL=http://192.168.7.178/icp/js/index.js",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=9JwnLnLnimla84XFam73shym7TqyjDsi&view=null",
                LAST);

        web_url("for_png.js",
                "URL=http://192.168.7.178/icp/js/for_png.js",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=9JwnLnLnimla84XFam73shym7TqyjDsi&view=null",
                LAST);

        web_url("loading_index.js",
                "URL=http://192.168.7.178/icp/js/loading_index.js",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=9JwnLnLnimla84XFam73shym7TqyjDsi&view=null",
                LAST);

        web_url("view.jsp",
                "URL=http://192.168.7.178/icp/view.jsp?sid=9JwnLnLnimla84XFam73shym7TqyjDsi&domainname=test.com",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=9JwnLnLnimla84XFam73shym7TqyjDsi&view=null",
                "Snapshot=t5.inf",
                "Mode=HTTP",
                LAST);

        web_url("left.jsp",
                "URL=http://192.168.7.178/icp/left.jsp?sid=9JwnLnLnimla84XFam73shym7TqyjDsi&domainname=test.com",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/icp/main.jsp?domainname=test.com&sid=9JwnLnLnimla84XFam73shym7TqyjDsi&view=null",
                "Snapshot=t6.inf",
                "Mode=HTTP",
                LAST);

        web_url("index.js_2",
                "URL=http://192.168.7.178/icp/js/index.js",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=9JwnLnLnimla84XFam73shym7TqyjDsi&domainname=test.com",
                LAST);

        web_url("popreceive.js",
                "URL=http://192.168.7.178/icp/js/popreceive.js",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=9JwnLnLnimla84XFam73shym7TqyjDsi&domainname=test.com",
                LAST);

        web_url("index.js_3",
                "URL=http://192.168.7.178/icp/js/index.js",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/left.jsp?sid=9JwnLnLnimla84XFam73shym7TqyjDsi&domainname=test.com",
                LAST);

        web_url("loading_right.js",
                "URL=http://192.168.7.178/icp/js/loading_right.js",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/view.jsp?sid=9JwnLnLnimla84XFam73shym7TqyjDsi&domainname=test.com",
                LAST);

        web_url("quota_info.jsp",
                "URL=http://192.168.7.178/icp/quota_info.jsp?sid=9JwnLnLnimla84XFam73shym7TqyjDsi",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.7.178/icp/left.jsp?sid=9JwnLnLnimla84XFam73shym7TqyjDsi&domainname=test.com",
                "Snapshot=t7.inf",
                "Mode=HTTP",
                LAST);

        web_url("index.js_4",
                "URL=http://192.168.7.178/icp/js/index.js",
                "Resource=1",
                "RecContentType=application/x-javascript",
                "Referer=http://192.168.7.178/icp/quota_info.jsp?sid=9JwnLnLnimla84XFam73shym7TqyjDsi",
                LAST);

        return 0;
}

wendy99 发表于 2009-7-7 12:34:57

在跟使用Loadrunner工具使用者交流的过程中,经常有人提到这个问题,基于HTML(HyperText Markup Language 超文本置标语言)模式录制与基于URL(Uniform Resource Locator的缩写,统一资源定位符,也被称为网页地址,是因特网上标准的资源的地址。)录制模式到底有什么不同?为什么通常情况下我们都会去选择使用URL模式去录制我们的业务脚本?所以在这里我把我知道的东西写出来跟同行分享和交流:51Testing软件测试网7zN-yv!g"KM | `.dcl#V,vbUf158294HTML是一种高级别的录制模式,这种模式是基于“浏览器”或者说是“内容敏感”的。这种录制选项是让浏览器去决定在回放下载HTML资源,哪些页面资源(比如图片或者Flash内容)是需要被下载。
2q5cn%[E)@"r15829451Testing软件测试网Z Z4dQ!g#I@w URL是一种低级别的录制模式,这种录制选项不允许浏览器去确定哪些页面资源(比如图片或者Flash内容)是需要下载的。每项资源在录制回话的过程中都被录制到脚本中。这种级别录制模式同时也会录制其他任何隐藏的对象,比如session ID(也就是会话ID)信息,包括发给服务端和从服务端收到的session ID信息。



不知道对你有帮助不
页: [1]
查看完整版本: LR的高级页面设置问题