空手道:处理来自调用特征文件的肥皂响应. [英] karate : handling soap response from a called feature file

查看:58
本文介绍了空手道:处理来自调用特征文件的肥皂响应.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一功能 鉴于您''

  • def净荷= read('')
  • 请求有效载荷
  • 肥皂动作"
  • 值=/信封/正文/响应/结果/数字
  • 打印值#按预期正确打印值

第二功能 背景: * def获取=读取('first.feature') * def数据=呼叫提取

second.feature Background: *def fetch = read('first.feature') *def data = call fetch

场景:

  • print data.response#以json格式打印肥皂响应.
  • def res = data.response
  • 打印res ["s:信封"] [""] ["s:Body"] ["Response"] [""] [结果" ;] [" _] [" a:num']
  • print data.response # prints the soap response in json format.
  • def res = data.response
  • print res["s:Envelope"][""]["s:Body"]["Response"][""]["Result"]["_"]["a:num']

first.feature可以正常工作(响应是在肥皂中) 当我尝试在其他功能中调用此功能时,响应为json格式.

first.feature works as expected ( response is in soap ) When I try to call this feature in another feature then the response is in json format.

我想使用此响应中的值将其传递给另一个请求. 我必须使用res ["s:Envelope"] ["_"] ["s:Body"] [] [] ..才能做到这一点.

I want to use a value from this response to pass it on to another request. I had to use res["s:Envelope"]["_"]["s:Body"][][].. to get to that.

是否有一种方法可以像我们在first.feature中一样轻松地从此响应中获取值? 请任何人让我知道如何实现这一目标.

Is there a way to easily fetch a value from this response as we do in first.feature? Please could anyone let me know how to achieve this.

推荐答案

进行此更改:

* xml res = data.response

我们将在下一版本中进行改进,如果可以测试develop分支并确认: https://github.com/intuit/karate/wiki/Developer-Guide

We will be improving this in the next version, it would be good if you can test the develop branch and confirm: https://github.com/intuit/karate/wiki/Developer-Guide

这篇关于空手道:处理来自调用特征文件的肥皂响应.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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