Mason
15 years agoFrequent Contributor
Inconsistent behavior with property expansion in xQuery assertions
We're trying to figure out why in some cases, SoapUI will throw exceptions on some properties that are not encased in single-quotes while other properties do not require single-quotes.
Here is an xQuery assert declaration that will cause an exception or will return an empty result set when attempting to select:
But if we run the same assertion with single quotes, it will proceed normally.
We have another assert that will work with or without the single quotes.
So, 2 questions.
1) What might account for this inconsistency?
2) Also, shouldn't SoapUI catch this exception and perhaps tell the user "why" (if possible) the syntax is wrong or if the property expands to null?
EDIT: Forgot to mention the error description (this is when the property is null):
"XQuery Match Assertion failed for path [declare namespace ns2='http://pat.ws.aab.att.com/webService/Subscriber'; declare namespace ns3='http://pat.ws.aab.att.com/webService/Contact'; { for $z in //ns3:IM[ns3:IM = ${#TestSuite#myInfo.im0.IM}]/ns3:type/text() order by $z return {data($z)} } ] : RuntimeException:java.lang.reflect.InvocationTargetException"
Here is an xQuery assert declaration that will cause an exception or will return an empty result set when attempting to select:
declare namespace ns2='http://pat.ws.aab.att.com/webService/Subscriber';
declare namespace ns3='http://pat.ws.aab.att.com/webService/Contact';
<result>
{
for $z in //ns3:IM[ns3:IM = ${#TestSuite#myInfo.im0.IM}]/ns3:type/text()
order by $z
return <type>{data($z)}</type>
}
</result>
But if we run the same assertion with single quotes, it will proceed normally.
declare namespace ns2='http://pat.ws.aab.att.com/webService/Subscriber';
declare namespace ns3='http://pat.ws.aab.att.com/webService/Contact';
<result>
{
for $z in //ns3:IM[ns3:IM = '${#TestSuite#myInfo.im0.IM}']/ns3:type/text()
order by $z
return <type>{data($z)}</type>
}
</result>
We have another assert that will work with or without the single quotes.
declare namespace ns2='http://pat.ws.aab.att.com/webService/Subscriber';
declare namespace ns3='http://pat.ws.aab.att.com/webService/Contact';
<result>
{
for $z in //ns3:phone[ns3:number = ${#TestSuite#myInfo.phone0.number}]/ns3:type/text()
order by $z
return <type>{data($z)}</type>
}
</result>
So, 2 questions.
1) What might account for this inconsistency?
2) Also, shouldn't SoapUI catch this exception and perhaps tell the user "why" (if possible) the syntax is wrong or if the property expands to null?
EDIT: Forgot to mention the error description (this is when the property is null):
"XQuery Match Assertion failed for path [declare namespace ns2='http://pat.ws.aab.att.com/webService/Subscriber'; declare namespace ns3='http://pat.ws.aab.att.com/webService/Contact'; { for $z in //ns3:IM[ns3:IM = ${#TestSuite#myInfo.im0.IM}]/ns3:type/text() order by $z return {data($z)} } ] : RuntimeException:java.lang.reflect.InvocationTargetException"