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/
相關文章
- 下載速度
- 檔案下載
- 檢查 http url 下載檔案的大小(qbit)HTTP
- 前端如何下載檔案流前端
- 如何下載 Ubuntu 映象檔案?Ubuntu
- 檔案程式設計、檔案下載程式設計
- windows下ftp定時執行批次下載檔案,windows下ftp定時執行批次下載檔案的一種方法WindowsFTP
- JAVA檔案下載Java
- Response下載檔案
- HttpClient 下載檔案HTTPclient
- FastApi下載檔案ASTAPI
- 00、下載檔案
- Ajax 下載檔案
- js 檔案下載JS
- ssl證書下載與安裝 – 如何下載ssl證書
- 如何使用curl命令下載檔案
- 檔案上傳下載
- Flutter 下載檔案操作Flutter
- python之檔案下載Python
- python 下載檔案demoPython
- Android原生下載(下篇)多檔案下載+多執行緒下載Android執行緒
- Linux中如何使用Aria2下載檔案Linux
- 檔案下載時前後臺MD5校驗
- macOS 下NFS 檔案系統掛載MacNFS
- springboot 中檔案的上傳和下載Spring Boot
- 如何使用post請求下載檔案
- Android下載檔案(一)下載進度&斷點續傳Android斷點
- springcloud中feign檔案上傳、下載SpringGCCloud
- npm下載速度優化NPM優化
- ADNI的fMRI檔案下載教程
- 下載檔案的15種方法
- 15種下載檔案的方法
- 檔案的上傳與下載
- QQ 群檔案下載後過期時間顯示 undefinedUndefined
- a標籤與Blob下載檔案的區別和獲取檔案下載進度
- 檔案傳輸中,上傳、下載速度和預期有差距如何解決?
- 6.1檔案下載、讀取
- goroutine&waitgroup下載檔案GoAI
- JAVA檔案上傳下載Java