zoukankan      html  css  js  c++  java
  • LoadRunner使用小技巧(转)

    http://softtest.chinaitlab.com/LoadRunner/746997_3.html

    LR使用小技巧:

    <!--[if !supportEmptyParas]--> <!--[endif]-->

    <!--[if !supportLists]-->1、             <!--[endif]-->问题:在用LR的Wdiff(VUGen->Tools->Compare with Vuser…)进行脚本比对查找需要关联点时,出现了“file no longer available”的提示信息

    解决方案:

    因为脚本保存路径中的文件夹存在空格,所以将文件夹重命名后,重新开启lr脚本,进行比较就ok啦

    <!--[if !supportEmptyParas]--> <!--[endif]-->

    <!--[if !supportLists]-->2、             <!--[endif]-->问题:使用LR路中socket脚本,如何实现关联,并且输出内容以进行检查

    解决方案:

    关联有两种,一种是自动关联,一种是手动关联

    关联主要参考的文档是data.ws,在data.ws中找到需要关联的地方,然后在Action中相应的buf后面进行关联,或者将脚本设置为Tree View模式,找到待关联的值,右键->Create Parameter就可以创建一个关联了,然后系统会提示用户是否用参数替换所有的值,选【ok】以后,可以在参数列表中查看,哪些需要替换的,需要替换的就保留,不需要的undo就可以了。

    关联用到的函数有三个:lrs_save_param、lrs_save_param_ex、lrs_save_searched_string

    <!--[if !supportEmptyParas]--> <!--[endif]-->

    可以在脚本中使用lr_output_message函数输入需要的内容进行脚本的调试,也可以通过该函数自己设置检查点,检查脚本是否正确。

    一般情况下在receive到的buffer部分做关联

    <!--[if !supportEmptyParas]--> <!--[endif]-->

    <!--[if !supportLists]-->3、             <!--[endif]-->问题:在用Controller 进行场景设置以后,运行时出现了“You do not have a for this Vuser type.Please contact Mercury Interactive to renew your license.”

    解决方案:

    原因是由于目前使用的License不支持Socket场景运行,将License替换一下就可以了。

    使用的License也就是目前网络上比较通用的两个:
    global 100user
    AEAMAUIK-YAFEKEKJJKEEA-BCJGI
    10000 web clients 
    AEABEXFR-YTIEKEKJJMFKEKEKWBRAUNQJU-KBYGB

    一开始使用的10000 web clients的,出现该问题,后来替换成global 100 user 就可以了。具体视情况而定。

    <!--[if !supportEmptyParas]--> <!--[endif]-->

    附:socket 例子

    <!--[if !supportEmptyParas]--> <!--[endif]-->

    Action

    <!--[if !supportEmptyParas]--> <!--[endif]-->

    /**********************************************************

     * Created by Mercury Interactive Windows Sockets Recorder

     * Created on: Wed Mar 26 09:52:02

    *********************************************************/

    #include "lrs.h"

    Action()

    {

       lr_rendezvous("flight_order_rendez");

        lr_start_transaction("flight_order");

        lrs_send("socket0", "buf4", LrsLastArg);

        lrs_receive("socket0", "buf5", LrsLastArg);

        lrs_send("socket0", "buf6", LrsLastArg);

        lrs_receive("socket0", "buf7", LrsLastArg);

        lrs_send("socket0", "buf8", LrsLastArg);

        lrs_receive("socket0", "buf9", LrsLastArg);

       lrs_save_searched_string("socket0", LRS_LAST_RECEIVED, "Parameter1", "LB/BIN=0##", "RB/BIN=###\x00", 1, 0, -1);

        lrs_send("socket0", "buf10", LrsLastArg);

        lrs_receive("socket0", "buf11", LrsLastArg);

       lrs_save_param("socket0", "buf11", "custom_no", 0, -1);

    <!--[if !supportEmptyParas]--> <!--[endif]-->

       if(lr_eval_string("<custom_no>")==""){

         lr_abort();

       }else{

          lr_output_message("the customer no is %d : ",lr_eval_string("<custom_no>"));

       }

       lrs_send("socket0", "buf12", LrsLastArg);

       lr_output_message("**********the passenger is*********   %s", lr_eval_string("<flight_order_name>"));

    //输出自定义参数

       lrs_receive("socket0", "buf13", LrsLastArg);

       lrs_save_searched_string("socket0", LRS_LAST_RECEIVED, "Parameter2", "LB/BIN=0##", "RB/BIN=###\x00", 1, 0, -1);

        lr_output_message("==========the passenger's agent_no is =======: %s", lr_eval_string("<Parameter2>"));              //输出使用lrs_save_searched_string函数创建的参数

        lrs_send("socket0", "buf14", LrsLastArg);

        lrs_receive("socket0", "buf15", LrsLastArg);

        lrs_send("socket0", "buf16", LrsLastArg);

        lrs_receive("socket0", "buf17", LrsLastArg);

        lr_end_transaction("flight_order", LR_AUTO);

        return 0;

    }

    <!--[if !supportEmptyParas]--> <!--[endif]-->

    <!--[if !supportEmptyParas]--> <!--[endif]-->

    Data.ws:

    ;WSRData 2 1

    <!--[if !supportEmptyParas]--> <!--[endif]-->

    send buf0 55

       "4##SELECT agent_name FROM AGENTS ORDER BY agent_name###"

    recv buf1 55

       "0##Alex#Amanda#Debby#Julia#Mary#Robert#Sharon#Suzan###"

       "x00"

    send buf2 68

       "2##1## SELECT DISTINCT departure FROM Flights ORDER BY departure ###"

    recv buf3 56

       "0##Denver#Los Angeles#Portland#San Francisco#Seattle###"

       "x00"

    send buf4 308

       "2##0##SELECT departure, flight_number, departure_initials, day_of_week, ar"

       "rival_initials, arrival, departure_time, arrival_time, airlines, seats_ava"

       "ilable, ticket_price, mileage   FROM  Flights WHERE arrival = 'San Francis"

       "co' AND departure = 'Portland' AND day_of_week = 'Wednesday'ORDER BY fligh"

       "t_number ###"

    <!--[if !supportEmptyParas]--> <!--[endif]-->

    recv buf5 273

       "0##1836;250;1636;07:25 PM;POR;Wednesday;SFO;08:51 PM;TWA;152;Portland#2218"

       ";250;2018;12:48 PM;POR;Wednesday;SFO;02:18 PM;AA;126;Portland#5230;250;503"

       "0;08:37 AM;POR;Wednesday;SFO;10:03 AM;TWA;152;Portland#5457;250;5257;03:49"

  • 相关阅读:
    Echarts 源码解读 一:zrender源码分析1var zr = zrender.init(document.getElementById(‘main‘));
    Vue3 script setup 语法糖详解
    TCP的状态 (SYN, FIN, ACK, PSH, RST, URG)
    vuerouter路由懒加载
    ECharts 源码解读 二
    前端必备10种设计模式
    VUE路由懒加载的3种方式
    RewriterConfig 配置
    JQ弹出层插件(tipsWindow 2.8)
    一个jQuery弹出层(tipsWindown)
  • 原文地址:https://www.cnblogs.com/molly8124-tech/p/3682209.html
Copyright © 2011-2022 走看看