一万年太久,只争朝夕。

loadrunner函数译解4

上一篇 / 下一篇  2008-08-21 11:16:51 / 个人分类:loadrunner

写脚本时常用的函数:根据给定的参数返回上一次 HTTP 请求的相应信息。很简单就不译不解了,呵呵。
web_get_int_property 

Returns specific information about the previous HTTP request.

int web_get_int_property (const int HttpInfoType); 

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

This function is supported for all Web scrīpts, and for WAP scrīpts running in HTTP mode only.
It is not supported for WAP scrīpts running in Wireless Session Protocol (WSP) replay mode.

The following example uses the web_get_int_property function to check if the scrīpt successfully accessed the my_home home page.

一个简单的例子:
{

int HttpRetCode;

web_url("my_home",

       "URL=http://my_home",

       "TargetFrame=_TOP",

       LAST);

HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);

if (HttpRetCode == 200)

       lr_log_message("The scrīpt successfully accessed the My_home home page");

       else

       lr_log_message("The scrīpt failed to access the My_home home page ");

}

Output:

HTTP_INFO_RETURN_CODE = 200

HTTP_INFO_DOWNLOAD_SIZE = 53685

HTTP_INFO_DOWNLOAD_TIME = 2204

 


TAG: LoadRunner loadrunner

 

评分:0

我来说两句

日历

« 2024-04-24  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 16117
  • 日志数: 23
  • 图片数: 3
  • 建立时间: 2008-03-12
  • 更新时间: 2009-02-11

RSS订阅

Open Toolbar