Karate &引用;未指定目标主机";在动态场景大纲中使用json数据时

Karate &引用;未指定目标主机";在动态场景大纲中使用json数据时,karate,Karate,我已经升级到1.0.0版,在使用0.9.6时遇到了一个运行正常的错误 下面是提供的空手道示例代码,我对其进行了一些修改,以显示我是如何得到错误的 Background: * url 'https://jsonplaceholder.typicode.com' * def id = read("id-list.json") Scenario Outline: [id: <id>] get all users and then get the f

我已经升级到1.0.0版,在使用0.9.6时遇到了一个运行正常的错误

下面是提供的空手道示例代码,我对其进行了一些修改,以显示我是如何得到错误的

 Background:
    * url 'https://jsonplaceholder.typicode.com'
    * def id = read("id-list.json")

 Scenario Outline: [id: <id>] get all users and then get the first user by id
    Given path 'users', <id>
    When method get
    Then status 200
    * print id

  Examples:
    | id |
错误:

Testing started at 11:12 ...
command: --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --name ^\[id\: .*\] get all users and then get the first user by id$ --glue com.intuit.karate C:/Users/danna/IdeaProjects/YXC/src/test/java/examples/users/users.feature
11:12:19.580 [main] DEBUG com.intuit.karate.Suite - [config] classpath:karate-config.js
11:12:19.585 [main] INFO  com.intuit.karate.Suite - backed up existing 'target\karate-reports' dir to: target\karate-reports_1616551939583
11:12:19.606 [main] INFO  c.intuit.karate.core.FeatureRuntime - found scenario at line: 18 - ^\[id\: .*\] get all users and then get the first user by id$
11:12:20.265 [main] INFO  com.intuit.karate - karate.env system property was: null 
11:12:20.333 [main] INFO  c.intuit.karate.core.FeatureRuntime - found scenario at line: 18 - ^\[id\: .*\] get all users and then get the first user by id$
11:12:20.338 [main] INFO  com.intuit.karate - karate.env system property was: null 
11:12:20.595 [main] ERROR com.intuit.karate - karate.org.apache.http.ProtocolException: Target host is not specified, http call failed after 250 milliseconds for url: /users/1
11:12:20.596 [main] ERROR com.intuit.karate - src/test/java/examples/users/users.feature:12
When method get
http call failed after 250 milliseconds for url: /users/1
src/test/java/examples/users/users.feature:12

http call failed after 250 milliseconds for url: /users/1
src/test/java/examples/users/users.feature:12
11:12:20.596 [main] INFO  c.intuit.karate.core.FeatureRuntime - found scenario at line: 18 - ^\[id\: .*\] get all users and then get the first user by id$
11:12:20.600 [main] INFO  com.intuit.karate - karate.env system property was: null 
11:12:20.601 [main] ERROR com.intuit.karate - karate.org.apache.http.ProtocolException: Target host is not specified, http call failed after 0 milliseconds for url: /users/2
11:12:20.601 [main] ERROR com.intuit.karate - src/test/java/examples/users/users.feature:12
When method get
http call failed after 0 milliseconds for url: /users/2
src/test/java/examples/users/users.feature:12

http call failed after 0 milliseconds for url: /users/2
src/test/java/examples/users/users.feature:12
我认为错误与此有关,但我不太确定。
如果您有任何帮助,我们将不胜感激。

谢谢您的报告。这听起来似乎与同一个bug有关,因此我们注意到:

现在,您可以通过将
url
行移动到
场景的第一行来解决问题

Testing started at 11:12 ...
command: --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --name ^\[id\: .*\] get all users and then get the first user by id$ --glue com.intuit.karate C:/Users/danna/IdeaProjects/YXC/src/test/java/examples/users/users.feature
11:12:19.580 [main] DEBUG com.intuit.karate.Suite - [config] classpath:karate-config.js
11:12:19.585 [main] INFO  com.intuit.karate.Suite - backed up existing 'target\karate-reports' dir to: target\karate-reports_1616551939583
11:12:19.606 [main] INFO  c.intuit.karate.core.FeatureRuntime - found scenario at line: 18 - ^\[id\: .*\] get all users and then get the first user by id$
11:12:20.265 [main] INFO  com.intuit.karate - karate.env system property was: null 
11:12:20.333 [main] INFO  c.intuit.karate.core.FeatureRuntime - found scenario at line: 18 - ^\[id\: .*\] get all users and then get the first user by id$
11:12:20.338 [main] INFO  com.intuit.karate - karate.env system property was: null 
11:12:20.595 [main] ERROR com.intuit.karate - karate.org.apache.http.ProtocolException: Target host is not specified, http call failed after 250 milliseconds for url: /users/1
11:12:20.596 [main] ERROR com.intuit.karate - src/test/java/examples/users/users.feature:12
When method get
http call failed after 250 milliseconds for url: /users/1
src/test/java/examples/users/users.feature:12

http call failed after 250 milliseconds for url: /users/1
src/test/java/examples/users/users.feature:12
11:12:20.596 [main] INFO  c.intuit.karate.core.FeatureRuntime - found scenario at line: 18 - ^\[id\: .*\] get all users and then get the first user by id$
11:12:20.600 [main] INFO  com.intuit.karate - karate.env system property was: null 
11:12:20.601 [main] ERROR com.intuit.karate - karate.org.apache.http.ProtocolException: Target host is not specified, http call failed after 0 milliseconds for url: /users/2
11:12:20.601 [main] ERROR com.intuit.karate - src/test/java/examples/users/users.feature:12
When method get
http call failed after 0 milliseconds for url: /users/2
src/test/java/examples/users/users.feature:12

http call failed after 0 milliseconds for url: /users/2
src/test/java/examples/users/users.feature:12