简体   繁体   English

用.@读取 json 响应。 功能文件失败

[英]Reading json response with .@. fails in feature file

This is my response.这是我的回应。

` `

 { 
"Response": {
"_": {
  "QueryResponse": {
    "_": null,
    "@": {
      "totalCount": "55"
    }
  }
},
"@": {
  "time": "2020-12-22T18:21:58.862-08:00"
}
}
}

` `

I am doing this in feature file我在功能文件中这样做

* print "total count="+ result.session.runtimeData.read_count.Response._.QueryResponse.@.totalCount

and getting <eval>:1:78 Expected ident but found error result.session.runtimeData.read_taxcode_count.Response._.QueryResponse.@.totalCount ^ in <eval> at line number 1 at column number 78并获得<eval>:1:78 Expected ident but found error result.session.runtimeData.read_taxcode_count.Response._.QueryResponse.@.totalCount ^ in <eval> at line number 1 at column number 78

^ points to @ ^ 指向@

tried enclosing it in [''] many places for the response but I am not able to get the value.尝试将其包含在 [''] 许多地方以进行响应,但我无法获得该值。

Sometimes you don't need to complicate things, try this:有时你不需要把事情复杂化,试试这个:

* def count = get[0] response..totalCount

Also this would have worked:这也行得通:

* def count = response.Response._.QueryResponse['@'].totalCount

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从空手道功能中的文件读取 json 失败,出现 js 评估失败错误 - Reading json from file in Karate feature fails with js evaluation failed error 如何将一个功能文件的json列表响应作为参数传递给另一功能文件 - How to pass the json list response of one feature file as parameter to another feature file 读取 *.feature 文件中的属性时,空手道 properties.json 抛出 ReferenceError - Karate properties.json throws ReferenceError when Reading Properties in *.feature file 空手道无法将JSON传递到功能文件 - Karate Unable to pass JSON into feature file 如果在空手道的 feature2 中调用了 json,则一个 feature1 文件无法运行另一个 feature2 文件 - One feature1 file unable to run another feature2 file if have json called in feature2 in karate 空手道:当我调用带有场景大纲的功能文件时,功能文件循环失败 - KARATE: Loop over a feature file fails when I call a feature file with scenario outline 如何传递 karate.prevRequest 和 response 是 arguments 从一个功能文件到另一个功能文件 - How to pass karate.prevRequest and response are the arguments from one feature file to another feature file 空手道-从另一个特征文件中的响应中获取字段的值 - Karate- get value of a field from response in another feature file 空手道 API - 为什么不返回被调用的功能文件的响应 - Karate API - Why response in not returning to called feature file 如何调用 validate.js 并在功能文件中使用它(验证响应)? - How to call validate.js and use it in feature file (to verify the response)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM