Karate: how to pass dynamic path parameters?

妖精的绣舞 提交于 2020-12-13 07:20:23

问题


Suppose I have test scenario with exact same requirements but one path variable change as follows:

Scenario: Some scenario

Given  path /mypath/param1
When method get
Then status 200

I need to run the same test for /mypath/param2, /mypath/param3 as well.

Is there a simpler way to do it without requiring to separate the feature into a separate file and using data driven test?


回答1:


Yes, use the Scenario Outline which is a standard Cucumber pattern.

Scenario Outline: Some scenario

Given  path /mypath/<param>
When method get
Then status 200

Examples:
| param |
| foo   |
| bar   |


来源:https://stackoverflow.com/questions/52073473/karate-how-to-pass-dynamic-path-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!