51Testing软件测试论坛

标题: 求助!!!loadrunner中设置事务时有哪些基本原则 [打印本页]

作者: 吃饭睡觉    时间: 2016-1-5 14:43
标题: 求助!!!loadrunner中设置事务时有哪些基本原则
背景:网购平台,登陆后购买一件商品
问题1:
脚本中有很多的web_url();web_submit_data()函数,将这个脚本分解成多个事务,有什么原则呀?是不是每个事务中只包含web_submit_data()函数就好,还是要把web_url();也放到事务的开始和结束函数中间?
问题2:loadrunner中设置事务时有哪些基本原则呀?
PS:萌新一只,求抱大腿
如下是部分脚本:

web_url("index.php_2",
                "URL=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php?act=seccode&op=check&nchash=4ca943d8&captcha=chgx",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php?act=login&op=index",
                "Snapshot=t37.inf",
                "Mode=HTML",
                LAST);

        web_submit_data("index.php_3",
                "Action=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php?act=login&op=login&inajax=1",
                "Method=POST",
                "TargetFrame=",
                "RecContentType=text/xml",
                "Referer=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php?act=login&op=index",
                "Snapshot=t38.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=formhash", "Value=YLZtGduvZU-x_YPz5IPrM6GNm-SGaLC", ENDITEM,
                "Name=form_submit", "Value=ok", ENDITEM,
                "Name=nchash", "Value=4ca943d8", ENDITEM,
                "Name=user_name", "Value=test002", ENDITEM,
                "Name=password", "Value=123456", ENDITEM,
                "Name=captcha", "Value=chgx", ENDITEM,
                "Name=ref_url", "Value=", ENDITEM,
                "Name=", "Value=登???录", ENDITEM,
                LAST);

        web_url("index.php_4",
                "URL=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php?act=login&op=index",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t39.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=templates/default/images/toolbar.png", ENDITEM,
                "Url=templates/default/images/weixin.png", ENDITEM,
                "Url=templates/default/images/app.gif", ENDITEM,
                "Url=templates/default/images/shop/goods_meta_bg.png", ENDITEM,
                "Url=templates/default/images/point_bg.png", ENDITEM,
                LAST);

        web_url("index.php_5",
                "URL=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php?act=compare&op=checkcompare",
                "TargetFrame=_blank",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php",
                "Snapshot=t40.inf",
                "Mode=HTML",
                LAST);

        web_url("favicon.ico_2",
                "URL=http://www.ceshiwangzhan.com/ceshiwangzhan/favicon.ico",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t41.inf",
                "Mode=HTML",
                LAST);

        web_submit_data("index.php_6",
                "Action=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php",
                "Method=POST",
                "TargetFrame=",
                "RecContentType=text/html",
                "Referer=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php",
                "Snapshot=t42.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=act", "Value=buy", ENDITEM,
                "Name=op", "Value=buy_step1", ENDITEM,
                "Name=cart_id[]", "Value=100006|1", ENDITEM,
                EXTRARES,
                "Url=templates/default/images/buy/buy_step.gif", ENDITEM,
                LAST);

        web_url("favicon.ico_3",
                "URL=http://www.ceshiwangzhan.com/favicon.ico",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t43.inf",
                "Mode=HTML",
                LAST);

        web_submit_data("index.php_7",
                "Action=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php?act=buy&op=change_addr",
                "Method=POST",
                "TargetFrame=",
                "RecContentType=text/html",
                "Referer=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php",
                "Snapshot=t44.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=freight_hash", "Value=UgLrFNvuZTQxvVDHmf-FGOsyup0bD3mriXlj7yegE8Vvvpbz6Bj1b1duxSIcNslqfanfa5dDz5VDUOMNIkGXTKhh0-GkdtkZ8iUgsL2grSTXx_8kQYcP9L0", ENDITEM,
                "Name=city_id", "Value=121", ENDITEM,
                "Name=area_id", "Value=1619", ENDITEM,
                LAST);

        web_submit_data("index.php_8",
                "Action=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php",
                "Method=POST",
                "TargetFrame=",
                "RecContentType=text/html",
                "Referer=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php",
                "Snapshot=t45.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=cart_id[]", "Value=100006|1", ENDITEM,
                "Name=pay_message[2]", "Value=", ENDITEM,
                "Name=password", "Value=", ENDITEM,
                "Name=password_callback", "Value=", ENDITEM,
                "Name=act", "Value=buy", ENDITEM,
                "Name=op", "Value=buy_step2", ENDITEM,
                "Name=ifcart", "Value=", ENDITEM,
                "Name=pay_name", "Value=online", ENDITEM,
                "Name=vat_hash", "Value=60x-ntFZp9y2YXwrdJFUHW6H5rBXVKHIzY2", ENDITEM,
                "Name=address_id", "Value=7", ENDITEM,
                "Name=buy_city_id", "Value=121", ENDITEM,
                "Name=allow_offpay", "Value=0", ENDITEM,
                "Name=allow_offpay_batch", "Value=2:0", ENDITEM,
                "Name=offpay_hash", "Value=PbUm.QJMm4_4aE8Q2AQFrc9dGcvfmbiMshaZ8gz", ENDITEM,
                "Name=offpay_hash_batch", "Value=9ZR5PXlh_P2UrQ5waU61u-U684dM_dCHhdN5n8rE5N0SUBI", ENDITEM,
                "Name=ref_url", "Value=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php", ENDITEM,
                EXTRARES,
                "Url=templates/default/images/buy/pay-use.png", "Referer=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php?act=buy&op=pay&pay_sn=130505318978335004", ENDITEM,
                LAST);

        web_custom_request("wdinfo.php",
                "URL=http://qurl.f.360.cn/wdinfo.php",
                "Method=POST",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=application/octet-stream",
                "Referer=",
                "Snapshot=t46.inf",
                "Mode=HTML",
                "EncType=application/octet-stream",
                "BodyBinary=\\x1E\n\\x01\\x02!\\xFF\\x00\\x00\\x008\\x0E砲m峖撴5陘圠6\\x00\\x00\\x00\\x05\\xF9\r1覢fd膈癿-a縑\\x7F彍\\xF5\tc\\xFA\\x00鑯`\\xAB\\x0B\\xE4\\x16!膻喊糰\\x0Bi\\x14\\xD7\\x06啎\\x803[\\xC11R擫z#-v玱wHo2擴Ex\\xB6 皆$\\xEF.1孔\\x11\\x148*|to崒\\x17n䦆r岖<}磴D揶c\\x10\\xA3$\\x01陠r2椳\\xAB:\\x16)3癒$顰\\xF1;0[琺q\\x0E@\\xFC\\x085靇\\x05栞餸8U\\xCD+\\xF2\\x1C(票\\x0F4#\\x00墌\\x16\\x171x\\xC382迆",
                LAST);

        web_submit_data("index.php_9",
                "Action=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php?act=payment&op=real_order",
                "Method=POST",
                "TargetFrame=",
                "RecContentType=text/html",
                "Referer=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php?act=buy&op=pay&pay_sn=130505318978335004",
                "Snapshot=t47.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=pay_sn", "Value=130505318978335004", ENDITEM,
                "Name=payment_code", "Value=wxpay", ENDITEM,
                EXTRARES,
                "Url=templates/default/images/payment/icon-red.png", "Referer=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php?act=payment&op=real_order", ENDITEM,
                "Url=templates/default/images/payment/phone-bg.png", "Referer=http://www.ceshiwangzhan.com/ceshiwangzhan/shop/index.php?act=payment&op=real_order", ENDITEM,
                LAST);
作者: 远方的小企鹅    时间: 2016-1-5 14:58
一个脚本中可以添加多个事务。当然你可以只加一个事务,把开始和结束事务放到提交的这个请求前面就行
作者: wohuyuelong    时间: 2016-1-7 22:39
lr的事物,可以理解为请求开始 到 请求结束。
如:请求某一个页面,肯定是点击一下入口作为开始,到页面全部加载出来作为结束。那事物就是从点击开始,到全部返回,事物结束。
理解这句话,那就不在乎,一个lr事物中有多少个web_url   web_***
作者: jy503160    时间: 2016-1-8 13:48
我理解事务是给你自定义你要检查的内容,如果你只关注某个请求,就把这个请求放在一个事务里面。
一个web_url可以是一个事务,一个submit也可以是一个事务




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2