https协议的LoadRunner的录制

上一篇 / 下一篇  2015-10-08 16:48:55 / 个人分类:性能测试

近两天,一直被https协议录制纠结着,在网上搜索发现两篇文章
(1)

最近做个loadrunner测试https协议的,带安全证书认证,loadrunner访问不具有受到认可的证书的安全站点,脚本调试不过报“ie对安全证书设置有问题

 

先前服务器的一个参数设置为ClientAth="no",我在loadrunner中按下列操作都成功了,后来将服务器参数ClientAth="want"后报“ie对安全证书设置有问题

 

 

 

第一步,在ie中按第二种格式,导出安全证书为prcsc.cer,开发说这种格式就是loadrunner要求的pem格式(请问这种说法可对?

 

 

 

第二,我用第一步导出的安全证书在loadrunner中下列界面测试,提示成功

 

 

第三步,录了脚本后,我在脚本前面加入

web_set_certificate_ex(

"CertFilePath=prcsc.cer",

"CertFormat=PEM",

"KeyFilePath=prcsc.cer",

"KeyFormat=PEM",

"Password=",

LAST );

 

第四步,在vugen内,run-time settings->preferences->勾上WININET replay instead of Sockets

调试脚本,提示web_set_certificate_ex请求成功,但后面的脚本(第一个请求)报”ie对安全证书设置有问题(服务器的一个参数设置为ClientAth="no",我在loadrunner中操作都能成功,后来将服务器参数ClientAth="want"后报“ie对安全证书设置有问题”)



(2)


 

录制到的脚本如下:

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:\test1.pfx -out D:\test01.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、完成上面两步后可以正常录制脚本



第二篇文章说要先把cer格式的证书用openssl转换为pem,后来经过试验,不转换pem,第一篇文章里说的base64确实可以用,确实录到了用户名和密码


TAG:

 

评分:0

我来说两句

日历

« 2024-05-03  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 36748
  • 日志数: 11
  • 建立时间: 2015-09-28
  • 更新时间: 2016-12-26

RSS订阅

Open Toolbar