• loadrunner支持https协议的操作方法-经验总结


    loadrunner支持https协议的操作方法-经验总结

    问题:用户portal支持https协议,用loadrunner录制登陆脚本时发现未录制到用户名和密码

     

    录制到的脚本如下:

    login()

    {

     

            lr_think_time(10);

     

            web_url("verifycode.jsp",

                      "URL=https://192.168.211.246:56661/portal/common/jsp/verifycode.jsp?codeSource=loginverifycode&time=1330596177343",

                      "Resource=1",

                      "RecContentType=image/jpeg",

                      "Referer=https://192.168.211.246:56661/portal/indexAction",

                      "Snapshot=t2.inf",

                      LAST);

     

            web_url("192.168.211.246:38787_2",

                      "URL=http://192.168.211.246:38787/",

                      "Resource=0",

                      "RecContentType=text/html",

                      "Referer=https://192.168.211.246:56661/portal/indexAction",

                      "Snapshot=t3.inf",

                      "Mode=HTML",

                      EXTRARES,

                      "Url=https://192.168.211.246:56661/portal/common/style/image/head/topbg_line.jpg", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM,

                      "Url=https://192.168.211.246:56661/portal/common/style/image/shadowLW.jpg", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM,

                      "Url=https://192.168.211.246:56661/portal/common/style/image/tabM.jpg", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM,

                      "Url=https://192.168.211.246:56661/portal/common/style/image/tabBg.jpg", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM,

                      "Url=https://192.168.211.246:56661/portal/common/style/image/shadowRW.jpg", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM,

                      "Url=https://192.168.211.246:56661/portal/common/style/image/titleHot.gif", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM,

                      "Url=https://192.168.211.246:56661/portal/common/style/image/head/contanta_pic_y.gif", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM,

                      "Url=https://192.168.211.246:56661/portal/common/style/image/titleHot2.gif", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM,

                      "Url=https://192.168.211.246:56661/portal/common/style/image/shadowB.jpg", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM,

                      "Url=https://192.168.211.246:56661/portal/common/style/image/titleMyoder.gif", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM,

                      LAST);

     

            web_url("subscribeInfoQuery.action",

                      "URL=https://192.168.211.246:56661/portal/subscribeInfoQuery.action",

                      "Resource=0",

                      "RecContentType=text/html",

                      "Referer=https://192.168.211.246:56661/portal/indexAction",

                      "Snapshot=t4.inf",

                      "Mode=HTML",

                      LAST);

     

            return 0;

    }

     

     

    思考:是否是loadrunner不支持https

     

    解决:通过查找一些资料,其实loadrunner支持https协议,但需要在录制脚本时做一些修改,操作步骤如下:

    1、证书的准备

    常见的证书为:*.pfx格式,该种格式的证书可以通过双击运行安装到IE浏览器上。用户在访问的时候就可以使用到。

    但这种证书并不是LoadRunner所使用的类型,因此需要对其进行转换。将其转换为*.pem格式。

    转换方法如下:

    a)        安装openssl

    b)        运行C:<OpenSSL>/bin文件夹的openssl二进制文件,它将启动OpenSSL命令提示符

    c)        执行以下命令:pkcs12 -in D: est1.pfx -out D: est01.pemnodes

    d)        执行后,将会在指定目录生成test01.pem文件,这个文件将会在下一个步骤,对LoadRunner进行配置的时候使用到。

     

    2LR配置

    启动LoadRunner,打开Recording Option选项。

    [图片]

    留意红色框中的选项。

    选择后,单击New Enty

    [图片]

    红框中的配置为服务器的ip和端口号,按照测试所需要的实际地址进行配置就可以

    配置后,将Use specified client-side certificate[Base64/PEM]钩选,为使用客户端证书访问。

    单击...选择刚刚转换生成的客户端证书。

    [图片]

    如果你为证书有设置密码,在这里也需要输入。

    到此为止所有与http区别的配置就完成了。

    录制后,可以在脚本的开始,看到LoadRunner新生成的语句

    web_set_certificate_ex("

    CertFilePath=test01.pem",   //密钥文件

                   "CertFormat=PEM",

                   "KeyFilePath=test01.pem",   //密钥文件

                   "KeyFormat=PEM",         

                   "Password=123456",        //密钥密码

                   "CertIndex=1",

                   LAST);

     

    3、完成上面两步后可以正常录制脚本

  • 相关阅读:
    (Redis基础教程之十) 如何在Redis中运行事务
    (Python基础教程之十三)Python中使用httplib2 – HTTP GET和POST示例
    (Redis基础教程之六)如何使用Redis中的List
    (Redis基础教程之九) 如何在Redis中使用Sorted Sets
    (Python基础教程之十九)Python优先级队列示例
    (Python基础教程之十八)Python字典交集–比较两个字典
    (Python基础教程之十七)Python OrderedDict –有序字典
    Heap_Sort
    Quick_Sort
    Merge_Sort
  • 原文地址:https://www.cnblogs.com/zhengah/p/4252758.html
Copyright © 2020-2023  润新知