关于空手道使用带有查询参数的URL的问题

时间:2018-12-10 18:20:56

标签: intellij-idea cucumber gherkin karate

我正在尝试用空手道编写一个测试用例。网址中有一个“?”并不确定如何处理。我粘贴了以下代码:

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,以便它可以对照我的示例?

1 个答案:

答案 0 :(得分: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 |