zoukankan      html  css  js  c++  java
  • loadrunner 录制PUT DELETE UPDATE 操作

    loadrunner 在模拟移动端接口发送的时候,可能无法进行录制,这个时候可能需要手工进行录制,采用web_custom_request方法即可,查看loadrunner helper中关于该函数的说明:

    Allows you to create a custom HTTP request with any method supported by HTTP. 

    下面是restful中的一个实例:

    web_add_header("client_secret", "REMOTE_LINK_AND_OAUTH_2");
    web_add_header("Accept", "application/json");


    web_reg_save_param("PIN_JWT",
    "LB="JWT": "",
    "RB="",
    "Ord=1",
    "Search=All", //Headers,Body
    LAST);

    web_reg_find("Text=timestamp",
    "SaveCount=EncodePasswordGrant_COUNT",
    LAST );


    web_custom_request("EncodePasswordGrant",
    "URL=https://xxxxxx:13443/internal/util/jwt/encode/data",
    "Method=POST",
    "Resource=1",
    "Referer=",
    "Mode=HTML",
    "EncType=application/json",
    "Body={"nonce": "{pingetnonce}","timestamp": "{pintimestamp}","client_id": "REMOTE_LINK_AND_OAUTH_2","credential_type": "PIN","device_id": "{vin}","credential": "{pin}"}",
    LAST);

    其中method的参数根据help的定义(Method – any method supported by the HTTP protocol.)我们可以放支持任何http协议的方法。后续的脚本中我也尝试过PUT和DELETE的请求,服务器均能接受并处理。

    这里说明下,由于我的希望接收的内容为jason,所以我在header中定义了web_add_header("Accept", "application/json");

  • 相关阅读:
    去掉[]中的英文字符
    Python面向对象OOP
    Python内置模块
    Python面向对象
    Python文件操作
    Python元组数据类型详解
    Jenkins+postman发送邮件测试报告及附件
    Python列表数据类型详解
    Python面向对象高阶描述符与设计魔术方法
    Python字典数据类型详解
  • 原文地址:https://www.cnblogs.com/rubeitang/p/5749890.html
Copyright © 2011-2022 走看看