获取错误http请求失败:在空手道中使用路径时为空 [英] Getting error http request failed: null when using path in karate

查看:41
本文介绍了获取错误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请求失败:在空手道中使用路径时为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆