comparing operands xpath assertion expression with expected result in soapUI

无人久伴 提交于 2019-12-10 18:05:54

问题


I'm using soapUI 5 (non pro) and all i need is to validate(assert) a number is greater than zero in the expected result section. So this means

1) in XPath expression(Xpath match) I am declaring the below (I need to remove all text and only have numbers then check that number is greater than zero)

replace(//OUTBOUND_MESSAGE.MESSAGE_CONTENT, '[^0-9]','')

2) All i want to do in expected result is =!0 or number>0 so i attempted

${=!0} but doing that brings back a boolean T/F. I'm really lost :(


回答1:


The expression ${=!0} is not working as you expect. In SOAPUI this kind of expressions ${=expression} are executed as groovy script so really SOAPUI is executing !0 which is result is true and this is the expected result. This is why SOAPUI throws replace..., expecting [true].

I think that it's better to change you XPath expression to evaluate directly if your expression is >0:

number(replace(//OUTBOUND_MESSAGE.MESSAGE_CONTENT, '[^0-9]',''))>0

And as expected result simply set true.



来源:https://stackoverflow.com/questions/28872959/comparing-operands-xpath-assertion-expression-with-expected-result-in-soapui

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!