简体   繁体   English

如何在空手道dsl中读取和编辑json文件并将其作为请求发送

[英]How to read and edit a json file and send it as a request in karate dsl

The code i am trying out is : 我正在尝试的代码是:

Given url ApiAdminURL 给定URL ApiAdminURL

And path AdminPath 和路径AdminPath

And header apigateway-apikey = apiGatewayKey 和标头apigateway-apikey = apiGatewayKey

And header apigateway-basepath = 'lambdaTest' 和标题apigateway-basepath ='lambdaTest'

** json myReq = read('users.json') ** json myReq =已读('users.json')

** set myReq.apiConf.subscriptionTiers = ["Unlimited"] **设置myReq.apiConf.subscriptionTiers = [“ Unlimited”]

** print 'my subscriptions : ', myReq.apiConf **打印“我的订阅:”,myReq.apiConf

And request read('myReq.json') 并请求读取('myReq.json')

When method post 方法发布时

Then status 200 然后状态200

i can read the json file and get it in a variable "myReq" and now i want to send this edited myReq. 我可以读取json文件,并在变量“ myReq”中获取它,现在我想发送此已编辑的myReq。 json as my request but i am not able to do that. json作为我的请求,但我无法做到这一点。

Can someone please help. 有人可以帮忙吗?

Instead of And request read('myReq.json') 而不是And request read('myReq.json')

Shouldn't this work ! 这项工作不应该!

And request myReq

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在空手道DSL中操作xml文件的变量? - How to manipulate xml file's variable in Karate DSL? 如何从一个特征文件表中读取数据并传递值以在空手道的 *.json 文件中设置 json 参数? - How to read data from one feature file table and pass the value to set json parameter in a *.json file in karate? 如何在空手道框架的特征文件中读取响应头值? - how to read response header values in feature file of karate framework? 如何在空手道 DSL 框架中使用 PATH 处理 URL 中的参数? - How to handle parameters in the URL using PATH in Karate DSL framework? 空手道 DSL 框架是否能够将 POST 请求作为 url 编码格式传递? - Does Karate DSL Framework have the capability to pass a POST Request as a url encoded format? 空手道 DSL - 需要在 POST 请求中传递当前日期和过去日期作为参数 - Karate DSL - Need to Pass Current Date and Past Date as Parameters in the POST request 如何从 excel 电子表格中读取输入数据并在空手道框架中传递 JSON 有效载荷? - How to read input data from an excel spreadsheet and pass it JSON payload in karate framework? 如何参数化单个 Cucumber API 测试场景与空手道框架中的多个 Json 请求 - How to parametrise a single Cucumber API test Scenario with Multiple Json request in KARATE framework 在空手道 DSL 框架中,我们如何添加自定义步骤定义以将其功能扩展到 REST 功能之外? - In the Karate DSL Framework, how can we add custom step definitions to expand its functionalities beyond REST capabilities? 在空手道DSL中,如何将替换文本用于其他数据类型,例如int,float,Big等? - In Karate DSL, how can I use the replace text for other data types such as int, float, Big, etc.?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM