我正在使用 Karate API 框架中的 path 关键字连接字符串以形成 url。但是,我无法通过“?”。这是我正在做的:
Background:
* url 'https://api.cloud.abcde.com/animal/'
Scenario: Verify the get status
Given path 'herbivore?id=25'
When method get
Then status 200
当我运行测试时,我看到“?”作为 %3F 传递。我试图使用\来逃避它并尝试了一些其他答案但没有成功。我需要使用 url 编码吗?任何指示或帮助将不胜感激。 谢谢
最佳答案
对于这种情况,您应该使用 param
:
Scenario: Verify the get status
Given path 'herbivore'
And param id = 25
When method get
Then status 200
关于cucumber - Karate API 测试 - 在功能文件的 url 中转义 '?',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45422335/