51Testing软件测试论坛

标题: 新人求助!急急急! [打印本页]

作者: jjwang    时间: 2011-7-29 15:59
标题: 新人求助!急急急!
本帖最后由 jjwang 于 2011-7-29 16:10 编辑

本人是彻彻底底的新人啊,今天好不容易装好了lr11,测试的时候又遇到了很多困难,想请教各位大神啊!谢谢啦!问题如下:
我是对一个交易系统表单提交的网页进行测试,来模拟多人填写表单。
具体流程是这样的,先填写钱额与币种,然后按确定进入信用卡信息填写的界面,填写卡号,姓名,日期等内容,然后跳转到下一个界面,选择交易成功或者交易失败(脚本中选的是失败)。
1.由于第一次用回放功能,所以不知道回放到底怎么样会正确,在回放过程中没有报错,但是最后结束后显示replay status:failed,在跳到第二个页面的时候表单里的信息都是空的,想请教是不是我在录制时候填写的信息在回放的时候是看不到的?还是回放的时候只是显示所要用到的界面。
2.操作台显示pass,数据插入不到数据库中,看到网上说要做参数化和关联,都试过了,也不知道对不对,想请教是不是一定要这样才能把表单填写的信息插入到数据库中?
3.还有就是不知道为什么脚本代码中有重复
附件中有截图
下面是部分脚本的代码:
Action()
{

        web_url("index.htm",
                "URL=http://www.glbpay.com:81/gateway/test/index.htm",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                LAST);

        web_url("index.htm_2",
                "URL=http://www.glbpay.com:81/gateway/test/index.htm",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t2.inf",
                "Mode=HTML",
                EXTRARES,
                "URL=/favicon.ico", ENDITEM,
                LAST);

        lr_think_time(17);

        web_submit_form("Standard.aspx",
                "Snapshot=t3.inf",
                ITEMDATA,
                "Name=MERCHANTID", "Value=走模拟网关的117", ENDITEM,
                "Name=ORDERID", "Value=20110729142526843", ENDITEM,
                "Name=UILANG", "Value=zh-cn", ENDITEM,
                "Name=CALLBACKURL", "Value=http://www.glbpay.com:81/Gateway/Test/MerchantServer.htm", ENDITEM,
                "Name=ORDERDATE", "Value=20110729142526", ENDITEM,
                "Name=PAYCURRENCY", "Value={NewParam_23}", ENDITEM,
                "Name=PAYAMOUNT", "Value={NewParam_24}", ENDITEM,
                "Name=MARKAMOUNT", "Value=", ENDITEM,
                "Name=MARKCURRENCY", "Value=", ENDITEM,
                "Name=REQUESTDS", "Value=01ef44f7db571c6f457066033bfa76d7", ENDITEM,
                "Name=REQUESTDSATYPE", "Value=1", ENDITEM,
                "Name=PRODUCTS", "Value=MyProduct:100;", ENDITEM,
                "Name=REMARK1", "Value=my商户备注1", ENDITEM,
                "Name=REMARK2", "Value=my商户备注2", ENDITEM,
                "Name=REMARK3", "Value=my商户备注3", ENDITEM,
                "Name=SYSINTERFACEVERSION", "Value=1.0.0.0", ENDITEM,
                "Name=CUSTOMEREMAIL", "Value=ddd@dd.com", ENDITEM,
                "Name=CUSTOMERDELIVERYADDRESS", "Value=CUSTOMERDELIVERYADDRESS!", ENDITEM,
                "Name=CUSTOMERADDRESS", "Value=CUSTOMERADDRESS!", ENDITEM,
                "Name=CUSTOMERBILLINGADDRESS", "Value=CUSTOMERBILLINGADDRESS!", ENDITEM,
                "Name=CUSTOMERBILLINGCITY", "Value=CUSTOMERBILLINGCITY!", ENDITEM,
                "Name=CUSTOMERBILLINGPROVINCE", "Value=CUSTOMERBILLINGPROVINCE!", ENDITEM,
                "Name=CUSTOMERBILLINGCOUNTRY", "Value=CUSTOMERBILLINGCOUNTRY!", ENDITEM,
                "Name=CUSTOMERPHONE", "Value=CUSTOMERPHONE!", ENDITEM,
                LAST);
                                 
                                这里有个函数是web_submit_data,除了第一个参数是"Standard.aspx_2"外,其他都与web_submit_form一样

       
        lr_think_time(28);

//Correlation comment - Do not change!Original value='00000000000000000117' Name ='CorrelationParameter_1'

        web_reg_save_param_ex(
                "aramName=CorrelationParameter_1",
                "LB=\"",
                "RB=\" ",
                SEARCH_FILTERS,
                "Scope=Body",
                "RequestUrl=*/Standard.aspx*",
                LAST);

        web_submit_data("Standard.aspx_3",
                "Action=http://www.glbpay.com:81/gateway/Payment/Standard.aspx",
                "Method=POST",
                "RecContentType=text/html",
                "Referer=http://www.glbpay.com:81/gateway/Payment/Standard.aspx",
                "Snapshot=t5.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=__EVENTTARGET", "Value=", ENDITEM,
                "Name=__EVENTARGUMENT", "Value=", ENDITEM,
                "Name=__LASTFOCUS", "Value=", ENDITEM,
                     "Name=__VIEWSTATE", "Value=(。。。。。。。。很长一段,不知道是不是出错了)
                     "Name=ctl00$ddlLang", "Value=zh-cn", ENDITEM,
                "Name=rdCardType", "Value=107", ENDITEM,
                "Name=ctl00$bdMain$ucCardInfo$txtCardNum", "Value={NewParam_27}", ENDITEM,
                "Name=ctl00$bdMain$ucCardInfo$txtCardHolderName", "Value={NewParam_28}", ENDITEM,
                "Name=ctl00$bdMain$ucCardInfo$slExpireMonth", "Value={NewParam_29}", ENDITEM,
                "Name=ctl00$bdMain$ucCardInfo$slExpireYear", "Value={NewParam_30}", ENDITEM,
                "Name=ctl00$bdMain$ucCardInfo$txtCVV", "Value={NewParam_31}", ENDITEM,
                "Name=ctl00$bdMain$ucBillingInfo$txtStreet", "Value=CUSTOMERBILLINGADDRESS!", ENDITEM,
                "Name=ctl00$bdMain$ucBillingInfo$txtCity", "Value=CUSTOMERBILLINGCITY!", ENDITEM,
                "Name=ctl00$bdMain$ucBillingInfo$txtProvince", "Value=CUSTOMERBILLINGPROVINCE!", ENDITEM,
                "Name=ctl00$bdMain$ucBillingInfo$slCountry", "Value=ALB", ENDITEM,
                "Name=ctl00$bdMain$ucBillingInfo$txtPost", "Value={NewParam_32}", ENDITEM,
                "Name=ctl00$bdMain$ucBillingInfo$txtEmail", "Value=ddd@dd.com", ENDITEM,
                "Name=ctl00$bdMain$ucBillingInfo$txtPhone", "Value=CUSTOMERPHONE!", ENDITEM,
                "Name=ctl00$bdMain$ucBillingInfo$slBinCountry", "Value=ALB", ENDITEM,
                "Name=ctl00$bdMain$ucBillingInfo$txtIssuer", "Value={NewParam_33}", ENDITEM,
                "Name=ctl00$bdMain$btnPay", "Value=确认支付", ENDITEM,
                LAST);


                                这里有个函数是 web_submit_data,除了第一个参数为"Standard.aspx_4"外, 之后的与上面的web_submit_data是一模一样的


web_submit_form("TestBank.htm",
                "Snapshot=t7.inf",
                ITEMDATA,
                LAST);

        web_url("TestBank.htm_2",
                "URL=http://www.glbpay.com:81/Gateway//Test/TestBank.htm?MERCHANTID={CorrelationParameter_1}&ORDERID=00000000000000000524&AMOUNT=9999&CURRENCY=CNY&CARDNUM=999999******9999",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://www.glbpay.com:81/gateway/Payment/Standard.aspx",
                "Snapshot=t8.inf",
                "Mode=HTML",
                EXTRARES,
                "URL=/favicon.ico", ENDITEM,
                LAST);

        web_add_cookie("REF=ID=326c3cf12f2cf6a2:U=bcf729f1ed879bfd:FF=2D=zh-CN:NW=1:TM=1310432237M=1310432247:S=l7xwImP24i_QCtrK; DOMAIN=www.google.com.hk");

        web_add_cookie("NID=48=L6MrDMRQs5-oYGnlMlFtfm5rP_6wzoBL2CzYOO-sBfY3IX9arD_HjUaXMxT7BScNzeHSFdrU8_wlLM4x5Xkv7KyU5YP6kAqQ5b2Fu8V-_BSOWz4ZN13v4yXLPcAwG6Rp; DOMAIN=www.google.com.hk");

        web_submit_form("roduct1_Browser.aspx",
                "Snapshot=t9.inf",
                ITEMDATA,
                "Name=MERCHANTID", "Value={CorrelationParameter_1}", ENDITEM,
                "Name=ORDERID", "Value=00000000000000000524", ENDITEM,
                "Name=AMOUNT", "Value=9999", ENDITEM,
                "Name=CURRENCY", "Value=CNY", ENDITEM,
                "Name=CARDNUM", "Value=999999******9999", ENDITEM,
                "Name=RESULT", "Value=Y", ENDITEM,
                LAST);

        web_url("roduct1_Browser.aspx_2",
                "URL=http://www.glbpay.com:81/Gateway//Response/Test/Product1_Browser.aspx?MERCHANTID={CorrelationParameter_1}&ORDERID=00000000000000000524&AMOUNT=9999&CURRENCY=CNY&CARDNUM=999999******9999&RESULT=Y",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://www.glbpay.com:81/Gateway//Test/TestBank.htm?MERCHANTID={CorrelationParameter_1}&ORDERID=00000000000000000524&AMOUNT=9999&CURRENCY=CNY&CARDNUM=999999******9999",
                "Snapshot=t10.inf",
                "Mode=HTML",
                EXTRARES,
                "URL=http://www.google.com.hk/extern_js/f/CgV6aC1DThICaGsrMEU4ACwrMFo4ACwrMA44ACwrMBc4ACwrMDw4ACwrMFE4ACwrMFk4ACwrMAo4AEACmgICY2MsKzAWOAAsKzAZOAAsKzAlOAAsKzAqOAAsKzArOAAsKzBBOAAsKzBNOAAsKzBOOAAsKzBTOACaAgZzZWFyY2gsKzBUOAAsKzBfOACaAidtb3ZlX2NhY2hlX3NpbWlsYXJfaW50b192aXN1YWxfc25pcHBldHMsKzBpOAAsKzB4OAAsKzCKATgAmgIFbGlnaHQsKzAdOAAsKzAYOAAsKzAmOAAsgAJSkAJI/ZOC6fcwARLA.js", "Referer=http://www.google.com.hk/", ENDITEM,
                "URL=http://www.google.com.hk/favicon.ico", ENDITEM,
                "URL=http://www.google.com.hk/images/nav_logo82.png", "Referer=http://www.google.com.hk/", ENDITEM,
                "URL=http://www.google.com.hk/extern_chrome/279f9675af0e6eea.js", "Referer=http://www.google.com.hk/", ENDITEM,
                "URL=http://www.google.com.hk/csi?v=3&s=webhp&action=&e=17259,23756,24878,27400,28505,28936,29816,30465,31388,31406,31608,31718&ei=jlIyTsm_M4aYmQX08L2JDw&expi=17259,23756,24878,27400,28505,28936,29816,30465,31388,31406,31608,31718&imc=2&imn=2&imp=1&rt=xjsls.943,prt.1020,ol.1275,iml.1244,xjses.1730,xjsee.1783,xjs.1800", "Referer=http://www.google.com.hk/", ENDITEM,
                LAST);

        web_url("csi",
                "URL=http://www.google.com.hk/csi?v=3&s=webhp&action=&e=17259,23756,24878,27400,28505,28936,29816,30465,31388,31406,31608,31718&ei=jlIyTsm_M4aYmQX08L2JDw&expi=17259,23756,24878,27400,28505,28936,29816,30465,31388,31406,31608,31718&imc=2&imn=2&imp=1&rt=xjsls.943,prt.1020,ol.1275,iml.1244,xjses.1730,xjsee.1783,xjs.1800",
                "Resource=0",
                "Referer=http://www.google.com.hk/",
                "Mode=HTML",
                LAST);

return 0;
}                           
大家帮帮我吧,小弟谢谢各位啦!在线等啊!
作者: jjwang    时间: 2011-7-29 16:04
自己先顶下 大家帮帮忙啊~·谢谢大家了




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