amokeeper 发表于 2009-11-26 15:18:53

loarunner调试脚本,过长请求内容问题。有图有代码。(问题解决)

工具版本:8.0
协议web/http
系统:保险理赔系统定损后,提交

由于定损请求数据过长,loadrunner自动将请求的内容用一个变量代替,body_variable_1 ,然后自动生成一个文件,里面有body_variable_1 的定义,包含了提交请求的内容。
问题是:我需要在请求的内容中坐参数化,但是在变量文件中,不知道从何做起。希望大家有遇到相同情况的或者有解决办法的指点一二,感激不尽!


脚本提交请求语句:
        web_custom_request("certainLossSave.do",
                "URL=http://10.0.123.16:7005/claim/certainLossSave.do",
                "Method=POST",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://10.0.123.16:7005/claim/certainLossBeforeEdit.do?RegistNo={registnofind}&lossTypeFlag=&insureCarFlag=1&lossItemCode=1&lossItemName=黑E23659&swfLogFlowID={swflogflowidfind}&swfLogLogNo=6&status=0&riskCode=DDN&editType=ADD&nodeType=certa&businessNo={registnofind}&keyIn={registnofind}&policyNo=23320300BDDN2009000007&modelNo=13&nodeNo=4&dfFlag=",
                "Snapshot=t79.inf",
                "Mode=HTTP",
                body_variable_1,
                LAST);


生成的文件名:lrw_custom_body.h

[ 本帖最后由 amokeeper 于 2009-11-27 10:45 编辑 ]

dennyqiang 发表于 2009-11-27 00:28:14

曲线救国 -- 每次运行脚本时用LR重写一次lrw_custom_body.h(文件读写操作),将新内容写进去 (未验证,只是提供一种思路而已)

msnshow 发表于 2009-11-27 09:20:52

好像是同样的方法参数化

amokeeper 发表于 2009-11-27 10:44:39

昨天又试了一遍参数化,脚本成功了
分析原因:
是参数化的时候,遇到要参数的数据发生了换行,替换的时候没有替换成功,所以导致了参数化失败。
还是自己不仔细的缘故啊    呵呵   谢谢大家!

amokeeper 发表于 2009-11-27 10:45:07

回复 3# 的帖子

正常参数化过程呵呵

tianyl0808 发表于 2012-7-30 16:08:13

我也遇到了同样的问题,不知道怎么对lrw_custom_body.h中的动态值参数化,红色字是动态生成的值。代码如下,希望各位帮帮忙指点下,感激不尽。
ACTION:
        web_custom_request("SaveDocMain.do",
                "URL=http://172.19.41.40:8080/cipgedit/editor/SaveDocMain.do?param=UUID=1343628604805$DocIDs=0$DocLibID=1$FVID=1",
                "Method=POST",
                "Resource=1",
                "Referer=",
                "Snapshot=t17.inf",
                "EncType=",
                body_variable_1,
                LAST);
lrw_custom_body.h:
        "------=_NextPart_01CD6E5D.2B0B09D0\r\n"

                "Content-Location: file:///C:/6F1AE635/1343628604805.files/colorschememapping.xml\r\n"

                "Content-Transfer-Encoding: quoted-printable\r\n"

                "Content-Type: text/xml\r\n"

                "\r\n"

                "<?xml version=3D\"1.0\" encoding=3D\"UTF-8\" standalone=3D\"yes\"?>\r\n"

                "<a:clrMap xmlns:a=3D\"http://schemas.openxmlformats.org/drawingml/2006/main\"=\r\n"

                " bg1=3D\"lt1\" tx1=3D\"dk1\" bg2=3D\"lt2\" tx2=3D\"dk2\" accent1=3D\"accent1\" accent=\r\n"

                "2=3D\"accent2\" accent3=3D\"accent3\" accent4=3D\"accent4\" accent5=3D\"accent5\" a=\r\n"

                "ccent6=3D\"accent6\" hlink=3D\"hlink\" folHlink=3D\"folHlink\"/>\r\n"

                "------=_NextPart_01CD6E5D.2B0B09D0\r\n"

                "Content-Location: file:///C:/6F1AE635/1343628604805.files/image001.gif\r\n"

                "Content-Transfer-Encoding: base64\r\n"

                "Content-Type: image/gif\r\n"

                "\r\n"

                "R0lGODlhvQCJAHcAMSH+GlNvZnR3YXJlOiBNaWNyb3NvZnQgT2ZmaWNlACH5BAEAAAAALAAAAAAB\r\n"

                "AAEAgAAAAAECAwICRAEAOw==\r\n"

                "\r\n"

                "------=_NextPart_01CD6E5D.2B0B09D0\r\n"

                "Content-Location: file:///C:/6F1AE635/1343628604805.files/image002.gif\r\n"

                "Content-Transfer-Encoding: base64\r\n"

                "Content-Type: image/gif\r\n"

                "\r\n"

                "R0lGODlhpgCQAHcAMSH+GlNvZnR3YXJlOiBNaWNyb3NvZnQgT2ZmaWNlACH5BAEAAAAALAAAAAAB\r\n"

                "AAEAgAAAAAECAwICRAEAOw==\r\n"

                "\r\n"

                "------=_NextPart_01CD6E5D.2B0B09D0\r\n"

                "Content-Location: file:///C:/6F1AE635/1343628604805.files/image003.gif\r\n"

                "Content-Transfer-Encoding: base64\r\n"

                "Content-Type: image/gif\r\n"

                "\r\n"

                "R0lGODlhkAC9AHcAMSH+GlNvZnR3YXJlOiBNaWNyb3NvZnQgT2ZmaWNlACH5BAEAAAAALAAAAAAB\r\n"

                "AAEAgAAAAAECAwICRAEAOw==\r\n"

                "\r\n"

                "------=_NextPart_01CD6E5D.2B0B09D0\r\n"

                "Content-Location: file:///C:/6F1AE635/1343628604805.files/image004.gif\r\n"

                "Content-Transfer-Encoding: base64\r\n"

                "Content-Type: image/gif\r\n"

                "\r\n"

                "R0lGODlhaAC9AHcAMSH+GlNvZnR3YXJlOiBNaWNyb3NvZnQgT2ZmaWNlACH5BAEAAAAALAAAAAAB\r\n"

                "AAEAgAAAAAECAwICRAEAOw==\r\n"

                "\r\n"

                "------=_NextPart_01CD6E5D.2B0B09D0\r\n"

                "Content-Location: file:///C:/6F1AE635/1343628604805.files/image005.gif\r\n"

                "Content-Transfer-Encoding: base64\r\n"

                "Content-Type: image/gif\r\n"

                "\r\n"

                "R0lGODlhRQCQAHcAMSH+GlNvZnR3YXJlOiBNaWNyb3NvZnQgT2ZmaWNlACH5BAEAAAAALAAAAAAB\r\n"

                "AAEAgAAAAAECAwICRAEAOw==\r\n"

                "\r\n"

                "------=_NextPart_01CD6E5D.2B0B09D0\r\n"

                "Content-Location: file:///C:/6F1AE635/1343628604805.files/image006.gif\r\n"

                "Content-Transfer-Encoding: base64\r\n"

                "Content-Type: image/gif\r\n"

                "\r\n"

                "R0lGODlhOwC9AHcAMSH+GlNvZnR3YXJlOiBNaWNyb3NvZnQgT2ZmaWNlACH5BAEAAAAALAAAAAAB\r\n"

                "AAEAgAAAAAECAwICRAEAOw==\r\n"

                "\r\n"

                "------=_NextPart_01CD6E5D.2B0B09D0\r\n"

                "Content-Location: file:///C:/6F1AE635/1343628604805.files/image007.gif\r\n"

                "Content-Transfer-Encoding: base64\r\n"

                "Content-Type: image/gif\r\n"

                "\r\n"

                "R0lGODlhvQC+AHcAMSH+GlNvZnR3YXJlOiBNaWNyb3NvZnQgT2ZmaWNlACH5BAEAAAAALAAAAAAB\r\n"

                "AAEAgAAAAAECAwICRAEAOw==\r\n"

                "\r\n"

                "------=_NextPart_01CD6E5D.2B0B09D0\r\n"

                "Content-Location: file:///C:/6F1AE635/1343628604805.files/image008.gif\r\n"

                "Content-Transfer-Encoding: base64\r\n"

                "Content-Type: image/gif\r\n"

                "\r\n"

                "R0lGODlhvQCfAHcAMSH+GlNvZnR3YXJlOiBNaWNyb3NvZnQgT2ZmaWNlACH5BAEAAAAALAAAAAAB\r\n"

                "AAEAgAAAAAECAwICRAEAOw==\r\n"

                "\r\n"

                "------=_NextPart_01CD6E5D.2B0B09D0\r\n"

                "Content-Location: file:///C:/6F1AE635/1343628604805.files/filelist.xml\r\n"

                "Content-Transfer-Encoding: quoted-printable\r\n"

                "Content-Type: text/xml; charset=\"utf-8\"\r\n"

                "\r\n"

                "<xml xmlns:o=3D\"urn:schemas-microsoft-com:office:office\">\r\n"

                " <o:MainFile HRef=3D\"../1343628604805.htm\"/>\r\n"

                " <o:File HRef=3D\"themedata.thmx\"/>\r\n"

                " <o:File HRef=3D\"colorschememapping.xml\"/>\r\n"

                " <o:File HRef=3D\"image001.gif\"/>\r\n"

                " <o:File HRef=3D\"image002.gif\"/>\r\n"

                " <o:File HRef=3D\"image003.gif\"/>\r\n"

                " <o:File HRef=3D\"image004.gif\"/>\r\n"

                " <o:File HRef=3D\"image005.gif\"/>\r\n"

                " <o:File HRef=3D\"image006.gif\"/>\r\n"

                " <o:File HRef=3D\"image007.gif\"/>\r\n"

                " <o:File HRef=3D\"image008.gif\"/>\r\n"

                " <o:File HRef=3D\"filelist.xml\"/>\r\n"

                "</xml>\r\n"

                "------=_NextPart_01CD6E5D.2B0B09D0--\r\n"

                "]]></mht></content></contents><newattachments /></document>" ;

云层 发表于 2012-7-30 17:41:07

再长的内容,写个变量丢过去就行了
页: [1]
查看完整版本: loarunner调试脚本,过长请求内容问题。有图有代码。(问题解决)