如何处理在URL中传递值所驱动的数据

问题描述 投票:1回答:1

我的查询是如何处理在URL中传递值所驱动的数据。例如URL'http:// localhost:8080 / // * Def id ='1'给定路径URL,'cat',id

id 1

我想传递id http://localhost:8080/cat/1 http://localhost:8080/cat/2中的动态值

dsl karate
1个回答
0
投票

请花点时间阅读文档,它真的会帮助你:https://github.com/intuit/karate#url

试试这个例子,你可以将它粘贴到一个新的功能文件中,看看它是否有效:

Scenario Outline: data driven url path
  Given url 'https://httpbin.org'
  And path 'anything', <id>
  When method get
  Then status 200
  And match response.url == 'https://httpbin.org/anything/' + <id> 

  Examples:
    | id |
    | 1  |
    | 2  |
© www.soinside.com 2019 - 2024. All rights reserved.