【问题标题】:Question about Karate using URL with query parameter关于使用带有查询参数的 URL 的空手道问题
【发布时间】:2018-12-10 18:20:55
【问题描述】:

我正在尝试用空手道编写一个测试用例。 URL 有一个“?”在里面,我不知道如何处理它。我已经粘贴了下面的代码:

Feature: WorkOrder API


Background:
* configure ssl = true
* url 'http://blahblah/v1/workorders/activitydetails?WorkOrderID='

Scenario Outline: Get all the workorder activity details by valid workorder id

Given path <ID>
When method get
Then status <statuscode>
And assert response != null


Examples:
  |     ID      | statuscode |
  |  123456     |     200    |
  |  -56874     |     400    |
  |  1.2345     |     422    |
  |  'abcdefg'  |     422    |
  |  'd1d30ecc-a031-4f73-8687-e2b2f7e49c2b' | 422 |

我应该如何编写 URL 以便它可以检查我的示例?

【问题讨论】:

    标签: intellij-idea cucumber gherkin karate


    【解决方案1】:

    没关系,我已经想通了。我不得不这样写:

    Feature: WorkOrder API
    
    
    Background:
    * configure ssl = true
    * url 'http://blahblah/v1/workorders/activitydetails?WorkOrderID='
    
    Scenario Outline: Get all the workorder activity details by valid workorder id
    
    Given path 'activitydetails'
    And param WorkOrderID = <ID>
    When method get
    Then status <statuscode>
    And assert response != null
    
    
    Examples:
      |     ID      | statuscode |
      |  123456     |     200    |
      |  -56874     |     400    |
      |  1.2345     |     422    |
      |  'abcdefg'  |     422    |
      |  'd1d30ecc-a031-4f73-8687-e2b2f7e49c2b' | 422 |
    

    【讨论】:

    • 太棒了!请将此答案标记为“已接受” - 我认为“自我”答案需要几天时间
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-10
    • 1970-01-01
    • 2015-04-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多