我尝试使用@setup,但失败了。例如,在一个功能文件中,我编写了一个场景并用@setup 标记,在这里我调用了一个 api 并捕获了大约 100 个 ID。我将这些 ID 作为路径中的另一个场景 api 调用传递给它
@setup
Scenario:
* url 'https://httpbin.org/anything'
* path id
* method get
* def testIds = $[*].Id # captured 100 Ids from the this call
Scenario Outline:
* url 'https://httpbin.org/anything'
* path id
* method get
Examples:
| karate.setup().testIds |
在调用 API 动态捕获 ID 并将它们传递到另一个 API 请求时,我仍然无意中解决了这个问题。请参考以下详情。你能告诉我如何解决这个问题吗?
当我尝试运行整个功能文件时,@setup 场景出现以下错误(我们正在调用另一个 api 并将 Id 捕获到 jsonObject 中。但是,它在按场景运行场景时不显示
01:14:41.185 [main] ERROR com.intuit.karate - javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target, http call failed after 604 milliseconds for url:
在这个场景大纲中我要消费上面调用响应信息的地方,得到了如下错误
ERROR dynamic expression evaluation failed:
这是一个工作示例。请参阅文档以了解这一点:
Feature: HTTP calls in a loop
@setup
Scenario:
* url 'https://jsonplaceholder.typicode.com/users'
* method get
Scenario Outline: id: ${id} | name: ${name}
* url `https://httpbin.org/anything/${id}`
* param name = name
* method get
Examples:
| karate.setup().response |