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:\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、完成上面兩步后可以正常錄制腳本


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM