Getting error http request failed: null when using path in karate(获取错误http请求失败:在空手道中使用路径时为空)
问题描述
我开始使用空手道进行测试,但当我使用"Path"关键字时,我收到"http请求失败:空"错误。
当使用以下方案时,它可以工作:
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
是一种解决方法,直到修复
这篇关于获取错误http请求失败:在空手道中使用路径时为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:获取错误http请求失败:在空手道中使用路径时为空


- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01
- 转换 ldap 日期 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 获取数字的最后一位 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01