获取错误http请求失败:在空手道中使用路径时为空
Getting error http request failed: null when using path in karate
我开始使用空手道进行测试,但是当我使用 "path" 关键字时,我收到 "http request failed: null" 错误。
当使用以下场景时,它有效:
Feature: items
Scenario: Testing /items response status
Given url appBaseUrl + '/items'
And param param1 = 1
And param param2 = 10
When method get
Then status 200
但是当我尝试在下面的代码中使用 "path" 关键字时,我最终得到了错误
Feature: items
Scenario: Testing /items response status
Given url appBaseUrl
And path 'items'
And param param1 = 1
And param param2 = 10
When method get
Then status 200
items.feature:8 - null
com.intuit.karate.exception.KarateException: items.feature:8 - null
at ✽.When method GET (items.feature:8)
我不知道我做错了什么。是否有一些额外的步骤需要完成而我遗漏了?
肯定还有其他原因,因为这应该有效。例如试试这个:
* def appBaseUrl = 'http://httpbin.org/anything'
Given url appBaseUrl
And path 'items'
And param param1 = 1
And param param2 = 10
When method get
Then status 200
在我的系统上运行良好。
所以我建议你遵循这个过程:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
编辑:这确实是一个错误:https://github.com/intuit/karate/issues/760 - 在修复
之前使用 karate-jersey
是一种解决方法
我开始使用空手道进行测试,但是当我使用 "path" 关键字时,我收到 "http request failed: null" 错误。
当使用以下场景时,它有效:
Feature: items
Scenario: Testing /items response status
Given url appBaseUrl + '/items'
And param param1 = 1
And param param2 = 10
When method get
Then status 200
但是当我尝试在下面的代码中使用 "path" 关键字时,我最终得到了错误
Feature: items
Scenario: Testing /items response status
Given url appBaseUrl
And path 'items'
And param param1 = 1
And param param2 = 10
When method get
Then status 200
items.feature:8 - null
com.intuit.karate.exception.KarateException: items.feature:8 - null
at ✽.When method GET (items.feature:8)
我不知道我做错了什么。是否有一些额外的步骤需要完成而我遗漏了?
肯定还有其他原因,因为这应该有效。例如试试这个:
* def appBaseUrl = 'http://httpbin.org/anything'
Given url appBaseUrl
And path 'items'
And param param1 = 1
And param param2 = 10
When method get
Then status 200
在我的系统上运行良好。
所以我建议你遵循这个过程:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
编辑:这确实是一个错误:https://github.com/intuit/karate/issues/760 - 在修复
之前使用karate-jersey
是一种解决方法