LoadRunner中如何驗證下載的檔案大小、統計下載時間、度量下載速度?
LoadRunner中的web_get_in_property函式可用於返回上一個HTTP請求的相關資訊,包括HTTP請求返回碼、下載大小、下載時間等:
The web_get_int_property function returns specific information about the previous HTTP request.
The meaning of the return value depends on the HttpInfoType argument. HttpInfoType can be any of the following options. The first constant in each pair (HTTP_*) is for C, the second (object.HTTP_*) is for object oriented languages.
HTTP_INFO_RETURN_CODE or object.HTTP_INFO_RETURN_CODE
The return code in HTTP response header.
HTTP_INFO_DOWNLOAD_SIZE or object.HTTP_INFO_DOWNLOAD_SIZE
The size (in bytes) of the last download, including the header, body, and communications overhead (for example, NTLM negotiation).
HTTP_INFO_DOWNLOAD_TIME or object.HTTP_INFO_DOWNLOAD_TIME
The time in (milliseconds) of the last download.
HTTP_INFO_TOTAL_REQUEST_STAT or object.HTTP_INFO_TOTAL_REQUEST_STAT
Returns the accumulated size of all headers and bodies since the first time web_get_int_property was issued with HTTP_INFO_TOTAL_REQUEST_STAT.
HTTP_INFO_TOTAL_RESPONSE_STAT or object.HTTP_INFO_TOTAL_RESPONSE_STAT
Returns the accumulated size, including header and body, of all responses since the first time web_get_int_property was issued with HTTP_INFO_TOTAL_RESPONSE_STAT
下面指令碼傳送HTTP請求下載一個PNG圖片,然後用web_get_int_property取得這次請求相關的資訊:
Action()
{
int returnCode;
float fFileDownloadSize, fFileDownloadTime, fFileDownloadRate;
web_url("Image1",
"URL=http://localhost/welcome.png",
"Resource=1",
LAST);
returnCode = web_get_int_property(HTTP_INFO_RETURN_CODE);
fFileDownloadSize = (web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE)/1024.); //in kilobytes
fFileDownloadTime = (web_get_int_property(HTTP_INFO_DOWNLOAD_TIME)/1000.); //in seconds
fFileDownloadRate = fFileDownloadSize/fFileDownloadTime; //in KB/s
lr_output_message("Return Code = %d",returnCode);
lr_output_message("Size of download was %.0f kilobytes; Time of download was %.3f seconds", fFileDownloadSize, fFileDownloadTime);
lr_output_message("Rate of download was %.2f KB/sec", fFileDownloadRate);
return 0;
}
參考:http://www.loadrunnertnt.com/how-tos/how-to-verify-file-downloaded/
相關文章
- 檔案下載
- 如何播放通過微信下載介面下載的音訊檔案音訊
- 如何下載 Ubuntu 映象檔案?Ubuntu
- 前端如何下載檔案流前端
- iOS開發網路篇之檔案下載、大檔案下載、斷點下載iOS斷點
- 檢查 http url 下載檔案的大小(qbit)HTTP
- ssl證書下載與安裝 – 如何下載ssl證書
- 檔案程式設計、檔案下載程式設計
- windows下ftp定時執行批次下載檔案,windows下ftp定時執行批次下載檔案的一種方法WindowsFTP
- 00、下載檔案
- Ajax 下載檔案
- FastApi下載檔案ASTAPI
- MVC 下載檔案MVC
- js 檔案下載JS
- Servlet下載檔案Servlet
- httpWebRequest 檔案下載HTTPWeb
- php檔案下載PHP
- .net 檔案下載
- php 檔案下載PHP
- HttpClient 下載檔案HTTPclient
- 檔案下載統計php程式設計 (轉)PHP程式設計
- 如何使用curl命令下載檔案
- iOS開發中利用AFNetworking下載大檔案以及下載檔案的刪除iOS
- 下載檔案的ContentType
- 檔案下載時前後臺MD5校驗
- 檔案上傳下載
- Flutter 下載檔案操作Flutter
- SpringMVC檔案下載SpringMVC
- 【springmvc】下載檔案SpringMVC
- 使用PHP下載檔案PHP
- 檔案下載相關
- ftp下載指定檔案FTP
- C#檔案下載C#
- PHP檔案下載原理PHP
- 利用secure crt下傳下載檔案
- 如何使用post請求下載檔案
- 如何用程式下載網上檔案
- npm下載速度優化NPM優化