Xquery Assertion for SoapUI 多种模式
Xquery Assertion for SoapUI multiple modes
我正在尝试为需要如下所示的响应创建断言:
<Names>
<NameList PropertyName="Record">
<Names>
<SimpleValue Value="Date :xx"/>
<SimpleValue Value="Name :xx"/>
</Names>
</NameList>
<NameList PropertyName="Record">
<Names>
<SimpleValue Value="Date :xx"/>
<SimpleValue Value="Name :xx"/>
</Names>
</NameList>
</Names>
断言应该是完全匹配。
我想出了一个看起来像这样的 Xquery 断言:
declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/';
<Names>
{
for $x in/Response/NameList/Names/NameList
return <NameList> {($x/@PropertyName)}
<Names>
{
for $x in/Response/NameList/Names/NameList/Names/SimpleValue
return <SimpleValue>{($x/@Value)} </SimpleValue>
}
</Names>
</NameList>
}
</Names>
但是,这个 returns 来自 Namelist 下每个 Names 节点的 SimpleValue。
它看起来像这样:
<Names>
<NameList PropertyName="Record">
<Names>
<SimpleValue Value="Date:xx"/>
<SimpleValue Value="Name:xx"/>
<SimpleValue Value="Date:xx"/>
<SimpleValue Value="Name:xx"/>
</Names>
</NameList>
<NameList PropertyName="Record">
<Names>
<SimpleValue Value="Date:xx"/>
<SimpleValue Value="Name:xx"/>
<SimpleValue Value="Date:xx"/>
<SimpleValue Value="Name:xx"/>
</Names>
</NameList>
</Names>
你能帮忙吗?
谢谢
要限制输出,请参考外循环中的变量:
{
for $y in $x/Names/SimpleValue
return <SimpleValue>{($y/@Value)} </SimpleValue>
}
我的专业版许可证目前已过期,因此我无法对此进行测试,但我很确定您需要执行以下操作:
declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/';
<Names>
{
for $x in/Response/NameList/Names/NameList
return <NameList> {($x/@PropertyName)}
<Names>
{
for $y in $x/Names/SimpleValue
return <SimpleValue>{($y/@Value)} </SimpleValue>
}
</Names>
</NameList>
}
</Names>
我正在尝试为需要如下所示的响应创建断言:
<Names>
<NameList PropertyName="Record">
<Names>
<SimpleValue Value="Date :xx"/>
<SimpleValue Value="Name :xx"/>
</Names>
</NameList>
<NameList PropertyName="Record">
<Names>
<SimpleValue Value="Date :xx"/>
<SimpleValue Value="Name :xx"/>
</Names>
</NameList>
</Names>
断言应该是完全匹配。
我想出了一个看起来像这样的 Xquery 断言:
declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/';
<Names>
{
for $x in/Response/NameList/Names/NameList
return <NameList> {($x/@PropertyName)}
<Names>
{
for $x in/Response/NameList/Names/NameList/Names/SimpleValue
return <SimpleValue>{($x/@Value)} </SimpleValue>
}
</Names>
</NameList>
}
</Names>
但是,这个 returns 来自 Namelist 下每个 Names 节点的 SimpleValue。 它看起来像这样:
<Names>
<NameList PropertyName="Record">
<Names>
<SimpleValue Value="Date:xx"/>
<SimpleValue Value="Name:xx"/>
<SimpleValue Value="Date:xx"/>
<SimpleValue Value="Name:xx"/>
</Names>
</NameList>
<NameList PropertyName="Record">
<Names>
<SimpleValue Value="Date:xx"/>
<SimpleValue Value="Name:xx"/>
<SimpleValue Value="Date:xx"/>
<SimpleValue Value="Name:xx"/>
</Names>
</NameList>
</Names>
你能帮忙吗? 谢谢
要限制输出,请参考外循环中的变量:
{
for $y in $x/Names/SimpleValue
return <SimpleValue>{($y/@Value)} </SimpleValue>
}
我的专业版许可证目前已过期,因此我无法对此进行测试,但我很确定您需要执行以下操作:
declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/';
<Names>
{
for $x in/Response/NameList/Names/NameList
return <NameList> {($x/@PropertyName)}
<Names>
{
for $y in $x/Names/SimpleValue
return <SimpleValue>{($y/@Value)} </SimpleValue>
}
</Names>
</NameList>
}
</Names>