Karate 空手道不';t匹配从函数中获取的xml

Karate 空手道不';t匹配从函数中获取的xml,karate,Karate,我必须验证从函数中获得的XML片段,但在应该匹配的时候匹配也会失败 为了解释我的需求,我必须测试一个web服务,作为响应,它将一条soap消息发送到主体中,该消息包含一个用base64编码的xml片段。在我的空手道测试中,我用一个函数来解码这个片段,并用模糊匹配来验证它,但每次匹配都失败了 我做了一个测试,其中XML“a”是显式定义的,XML“B”是从a==B的函数中获得的。然后我定义了一个XML“C”,它应该匹配这两个,但只匹配定义的一个显式 Feature: Background: *

我必须验证从函数中获得的XML片段,但在应该匹配的时候匹配也会失败

为了解释我的需求,我必须测试一个web服务,作为响应,它将一条soap消息发送到主体中,该消息包含一个用base64编码的xml片段。在我的空手道测试中,我用一个函数来解码这个片段,并用模糊匹配来验证它,但每次匹配都失败了

我做了一个测试,其中XML“a”是显式定义的,XML“B”是从a==B的函数中获得的。然后我定义了一个XML“C”,它应该匹配这两个,但只匹配定义的一个显式

Feature: 

Background:

* def buildXml = 
"""
function(param){ 
    return '<root><hello>world</hello><foo>bar</foo></root>';
}
"""

Scenario: 

* def a = <root><hello>world</hello><foo>bar</foo></root>
* def b = buildXml()
* def c =
"""
<root>
    <hello>world</hello>
    <foo>#ignore</foo>
</root>
"""

* match a == b
* match a == c
* match b == c

功能:
背景:
*def buildXml=
"""
函数(参数){
返回“世界酒吧”;
}
"""
脚本:
*def a=世界酒吧
*def b=buildXml()
*def c=
"""
世界
#忽略
"""
*匹配a==b
*匹配a==c
*匹配b==c

最后一场比赛失败,但应该通过。

只要一个小变化,你就很好了:

* xml b = buildXml()
原因: