loadrunner测试下载服务器性能

服务器是用nginx做的一个重定向下载:

Action()
{ 
    int returnCode;
    float fFileDownloadSize, fFileDownloadTime, fFileDownloadRate;
    lr_start_transaction("TvProgram");
    web_submit_data("TvProgram", 
     "Action=http://172.21.13.72/iPG/T-nsp/TvProgram.do?", 
     "Method=GET", 
     "RecContentType=text/html", 
     "Mode=HTTP", 
     ITEMDATA,
     "Name=userId","Value=6500841",ENDITEM,
     "Name=channelId","Value={channelId}",ENDITEM,
     "Name=startDate","Value=2017-10-14",ENDITEM,
     "Name=endDate","Value=2017-10-21",ENDITEM,
     "Name=gzip","Value=1",ENDITEM,
     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
    if (returnCode!=200||fFileDownloadSize<5||fFileDownloadTime>0.5)
    {
      lr_output_message("error!returnCode=%d,Size of download was %.0f kilobytes; Time of download was %.3f seconds",returnCode, fFileDownloadSize, fFileDownloadTime);
      lr_end_transaction("TvProgram" ,LR_FAIL);
    }
    else
    {

         lr_end_transaction("TvProgram" ,LR_PASS);
    }


      return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值