Forum Discussion

oolongice's avatar
14 years ago

help,how to match null value with xpath assertion?

>:(
i create a jdbc step,and it return result1,
and i create a request to visit the webservice ,and it return result2,
now,i want to compare result1 to result2,
and i have some problem,
some times the upVale will be null,and i don't know how to compare it flexible
or can i write a script step to compare result1 to result2.
for example:
result1:
<Row rowNumber="1">
<ID>12</ID>
<LOW_VALUE>13</LOW_VALUE>
<upValue/>
</Row>
result2:
<RuleValue xmlns="http://domain.service.common.couponcore.alipay.com" xmlns:ns2="http://domain.service.common.couponcore.alipay.com" xmlns:ns1="http://facade.service.common.couponcore.alipay.com" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id>12</id>
<lowValue>13</lowValue>
<upValue xsi:nil="true"/>
</RuleValue>

and now,i add a xpath assertion in the jdbc step,the expected result is:
result1:
<Row rowNumber="1">
<ID>${getCouponRule - Request#Response#declare namespace ns1='http://domain.service.common.couponcore.alipay.com'; declare namespace ns2='http://facade.service.common.couponcore.alipay.com'; //ns2:getCouponRuleResponse[1]/ns2:out[1]/ns1:CouponRule[1]/ns1:values[1]/ns1:RuleValue[1]/ns1:id[1]}</ID>
<LOW_VALUE>${getCouponRule - Request#Response#declare namespace ns1='http://domain.service.common.couponcore.alipay.com'; declare namespace ns2='http://facade.service.common.couponcore.alipay.com'; //ns2:getCouponRuleResponse[1]/ns2:out[1]/ns1:CouponRule[1]/ns1:values[1]/ns1:RuleValue[1]/ns1:lowValue[1]}</LOW_VALUE>
<LOW_VALUE>${getCouponRule - Request#Response#declare namespace ns1='http://domain.service.common.couponcore.alipay.com'; declare namespace ns2='http://facade.service.common.couponcore.alipay.com'; //ns2:getCouponRuleResponse[1]/ns2:out[1]/ns1:CouponRule[1]/ns1:values[1]/ns1:RuleValue[1]/ns1:upValue[1]}</LOW_VALUE>
</Row>
and when the upValue is null,the xpath assertion will be fail,and i don't know how to resolve it.