zoukankan      html  css  js  c++  java
  • 性能测试第六章-Loadrunner发送get和post请求

    get:

    webt_link和web_url函数

    post:

    Web_submit_form和Web_submit_data

    webt_link和Web_submit_form依赖于上下文

    web_url好Web_submit_data 不依赖于上下文,是绝对地址,一般使用这两种函数

    函数形式:web_url( const char *StepName, const char *url, , [EXTRARES, ,] LAST ); 

    这里写图片描述

    示例1:发送一个GET请求至ABC的首页

    web_url("www.abc.com", 
        "URL=http://www.abc.com/", 
        "TargetFrame=", 
        "TargetBrowser=Mercury Technologies", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Snapshot=t1.inf", 
        "Mode=HTML", 
        LAST );

    示例2:在Referer指定的页面发送一个HTTP请求

    web_url("Hit the Slopes and Save", 
        "URL=http://www.saleserver.com/American?BV_EngineID=fm_ski_sale_fall00guest.html", 
        "TargetFrame=Main", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=http://www.saleserver.com/American?BV_Operation=
        Dyn_Frame&..main–guest.tmpl", 
        "Snapshot=t3.inf", 
        "Mode=HTML", 
        LAST ); 

    示例3:下载示例

    web_url("Games", 
        "URL=ftp://joe:secret@mygames.com/games/archive/loderunner.exe", 
        "FtpAscii=1", 
        LAST ); 

    示例4:登录Secure站点

    web_url("Login", 
        "URL=https://secure.computing.com/scripts/login.asp?
        user=(username)&session={ssid}", 
        "RecContentType=text/html", 
        LAST ); 

    示例5:List of Resource Attributes的使用

    web_reg_save_param("extrares_11", 
        "LB/IC=<img src="", 
        "RB="", 
        "Ord=11", 
        LAST ); 
    
    web_url("web_url", 
        "URL=http://lazarus/html/links.html", //url必须的
        "TargetFrame=", 
        "Resource=0", 
        "Referer=", 
        "Mode=HTTP", 
        EXTRARES, 
        "URL={extrares_11}", ENDITEM, 
        LAST );

    函数语法:Int web_submit_data ( const char *StepName, , ITEMDATA, , [ EXTRARES, ,] LAST );

    返回值:LR_PASS(0)代表成功,LR_FAIL(1)代表失败。

    web_submit_data("default.aspx",

    "Action=http://lazarus/flightnet/default.aspx",//必须的

    "Method=POST",

    "TargetFrame=",

    "RecContentType=text/html",

    "Referer=http://lazarus/flightnet/",

    "Snapshot=t7.inf",

    "Mode=HTML",

    ITEMDATA,   //以及下面的参数是必须的

    "Name=grpType", "Value=radRoundtrip", ENDITEM,

    "Name=btnAvailableFlights", "Value=Next >", ENDITEM,

    LAST );

    录制时可以在录制前设置选择web_url好Web_submit_data 方式来进行录制:

    在Tools-->Recording Option-->Recording  点击进去,选择保存。

    来源:

  • 相关阅读:
    Zabbix 配置笔记
    Centos7安装MySQL5.7和Redis6.0流水账
    Elasticsearch, Kibana安装
    服务治理 Service Mesh & Kubernetes & Spring Cloud的异同 侵入式 非侵入式
    文思海辉 华为 银行 ODS (oCRM)
    Java Profiler JavaMemoryLeak Arthas
    动物:人类、熊类、马类 团队精神 与 鼓励
    BPMN Sketch Miner https://design.inf.usi.ch/bpmn-sketch-miner/#
    Architecture, Design and Web Information Systems Engineering
    Cloud design patterns
  • 原文地址:https://www.cnblogs.com/dyjnicole/p/8698691.html
Copyright © 2011-2022 走看看