简体   繁体   English

如何在空手道特征文件中传递体型?

[英]how to pass body type in Karate feature file?

I am new one for api automation and Karate framework, I have been asked to automate a GET request with Body Type = 'x-www-form-urlencoded' and other parameters(cannot share owing to security constraint), I have tried the below option but getting an error stating "no step-definition method match found for: Body Content-Type = 'application/x-www-form-urlencoded;charset=utf-8'我是 api 自动化和空手道框架的新人,我被要求使用 Body Type = 'x-www-form-urlencoded' 和其他参数(由于安全限制无法共享)自动执行 GET 请求,我尝试了以下选项,但收到一条错误消息,指出“找不到步骤定义方法匹配:Body Content-Type = 'application/x-www-form-urlencoded;charset=utf-8'

Following is the.Feature file contents that I have tried:以下是我尝试过的 .Feature 文件内容:

**Feature: First demo API 
  Scenario: API demo try
    Given url '{Given_url}'
    And Body Content-Type = 'application/x-www-form-urlencoded;charset=utf-8' 
    And Body {Grant_type:Value, scope:value}
    when method GET
    Then status 200**

I have even tried just passing the Body Type as 'x-www-form-urlencoded;charset' but still getting the same issue.我什至尝试将 Body Type 传递为 'x-www-form-urlencoded;charset' 但仍然遇到同样的问题。 Please help me and thanks in advance.请帮助我,并提前感谢。

Regards, V.Prashanth问候, V.Prashanth

Your syntax is wrong.你的语法是错误的。 Read the docs please: https://github.com/intuit/karate#header请阅读文档: https://github.com/intuit/karate#header

And header Content-Type = 'blah'
And request { Grant_type: 'Value', scope: 'value' }

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM