工作中的第一份LoadRunner脚本

录制的第一份脚本

虽然是第一份但是调试执行,跑场景等都成功了。

Action()
{

    web_url("login1.jsp", 
        "URL=http://192.168.1.102:8080/eos-default/countrules/login1.jsp", 
        "TargetFrame=", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=", 
        "Snapshot=t1.inf", 
        "Mode=HTML", 
        EXTRARES, 
        "Url=../common/jsp/codeImage.jsp?name=verifyCode&imageHeight=21&length=4&type=number", ENDITEM, 
        "Url=../common/skins/default/images/login.jpg", ENDITEM, 
        "Url=/favicon.ico", "Referer=", ENDITEM, 
        LAST);

    /*登录用户*/

    lr_rendezvous("登录");

    lr_start_transaction("登录");

    lr_think_time(5);

    web_submit_data("com.bjmtr.msu.countrules.login.flow", 
        "Action=http://192.168.1.102:8080/eos-default/countrules/com.bjmtr.msu.countrules.login.flow", 
        "Method=POST", 
        "TargetFrame=", 
        "RecContentType=text/html", 
        "Referer=http://192.168.1.102:8080/eos-default/countrules/login1.jsp", 
        "Snapshot=t2.inf", 
        "Mode=HTML", 
        ITEMDATA, 
        "Name=_eosFlowAction", "Value=login", ENDITEM, 
        "Name=url", "Value=", ENDITEM, 
        "Name=choose_lang", "Value=zh_CN", ENDITEM, 
        "Name=acOperator/userid", "Value={UserName}", ENDITEM, 
        "Name=acOperator/password", "Value=000000", ENDITEM, 
        "Name=verifyCode", "Value=", ENDITEM, 
        LAST);

    web_reg_find("Text=信息", 
            "SaveCount=Lnum", 
        LAST);

    web_url("com.bjmtr.msu.globalsearch.homePageMaintain.flow", 
        "URL=http://192.168.1.102:8080/eos-default/com.bjmtr.msu.globalsearch.homePageMaintain.flow", 
        "TargetFrame=", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=", 
        "Snapshot=t3.inf", 
        "Mode=HTML", 
        EXTRARES, 
        "Url=msu/img/top_bg.gif", ENDITEM, 
        "Url=msu/img/ss_btn.gif", ENDITEM, 
        "Url=msu/colorbox/images/border1.png", ENDITEM, 
        "Url=msu/colorbox/images/border2.png", ENDITEM, 
        "Url=msu/colorbox/images/loading.gif", ENDITEM, 
        LAST);

    lr_end_transaction("登录",LR_AUTO);

    /*登录成功!*/

//         if (atoi(lr_eval_string("{Lnum}")) > 0){
//
//             lr_output_message("登录成功!");
//
//         }
//
//         else{
//
//             lr_error_message("等录失败!");
//
//             return(0);
//
//      }
//
//         lr_output_message("当前用户是:%s",lr_eval_string ("{UserName}"));


    lr_think_time(6);

    web_url("供应商",
        "URL=http://192.168.1.102:8080/eos-default/com.bjmtr.msu.supplier.MsuSupplierMaintain.flow",
        "TargetFrame=",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://192.168.1.102:8080/eos-default/com.bjmtr.msu.globalsearch.homePageMaintain.flow",
        "Snapshot=t4.inf",
        "Mode=HTML",
        EXTRARES,
        "Url=msu/img/multi_import_btn.gif", ENDITEM,
        "Url=msu/img/pinggu_btn.gif", ENDITEM,
        "Url=msu/img/pre_btn.gif", ENDITEM,
        "Url=msu/img/next_btn.gif", ENDITEM,
        LAST);

    /*供应商搜索*/

    lr_rendezvous("搜索");

    lr_start_transaction("搜索");

    lr_think_time(9);

    web_submit_data("com.bjmtr.msu.supplier.MsuSupplierMaintain.flow",
        "Action=http://192.168.1.102:8080/eos-default/com.bjmtr.msu.supplier.MsuSupplierMaintain.flow",
        "Method=POST",
        "TargetFrame=",
        "RecContentType=text/html",
        "Referer=http://192.168.1.102:8080/eos-default/com.bjmtr.msu.supplier.MsuSupplierMaintain.flow",
        "Snapshot=t5.inf",
        "Mode=HTML",
        ITEMDATA,
        "Name=_eosFlowAction", "Value=pageQuery", ENDITEM,
        "Name=criteria/_expr[1]/name", "Value={Supplier}", ENDITEM,
        "Name=criteria/_expr[1]/_op", "Value=like", ENDITEM,
        "Name=criteria/_entity", "Value=com.bjmtr.msu.supplier.supplier.MsuSupplier", ENDITEM,
        "Name=page/begin", "Value=0", ENDITEM,
        "Name=page/isCount", "Value=true", ENDITEM,
        "Name=_eosFlowKey", "Value=9c6e50a9-67ce-4ab9-96f5-16e0aa8746c7.view1", ENDITEM,
        "Name=_eosFlowDataContext", "Value=rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAABdAAFZW1haWxzcgApY29tLnByaW1ldG9uLmRhdGEuc2RvLmltcGwuRGF0YU9iamVjdEltcGx4GL04YzDgqAIAAHhyAC5jb20ucHJpbWV0b24uZGF0YS5zZG8uaW1wbC5CYXNpY0RhdGFPYmplY3RJbXBs+9GVtEkm8NMDAAB4cHQAC2NvbW1vbmouc2RvdAAKRGF0YU9iamVjdHcEAAAAAHh4", ENDITEM,
        LAST);

    lr_end_transaction("搜索",LR_AUTO);

    /*搜索完成*/

//    lr_output_message("搜索到的公司是:%s",lr_eval_string ("{Supplier}"));

//    lr_think_time(9);

    return 0;
}

 

posted @ 2015-11-17 15:53  Blue●Sky  阅读(442)  评论(0编辑  收藏  举报