想要在具有相同路径的karateDSL方案中传递多个URL

时间:2019-08-06 07:18:34

标签: api karate

我要在后台传递的每个URL路径都应该有多个URL

背景:

 * header Authorization = call read('basic-auth.js') { username: 'admin', password: 'admin' }

背景:

  * header Authorization = call read('basic-auth.js') { username: 'admin', password: 'admin' }

    Scenario: Creates the webservices api page

    Given path 'rest/activescript/about'
    When method get
    Then status 200
    * def B = response
    * print B

实际结果:后台中的最后一个URL将在要执行的方案中考虑

预期结果:后台中的所有网址均应在差异情况下运行

1 个答案:

答案 0 :(得分:1)

以下应该起作用。尽管我不确定是否建议这样做。在整个运行过程中,通常在karate-config.js中定义url。

Scenario Outline: Scenario called multiple times
    * url '<newUrl>'
    * header Authorization = call read('basic-auth.js') { username: 'admin', password: 'admin' }
    Given path 'rest/activescript/about'
    When method get
    Then status 200
    * def B = response
    * print B

    Examples:
    |newUrl                                           |
    |URL1|
    |URL2 |