Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

comparing operands xpath assertion expression with expected result in soapUI

Tags:

xpath

soapui

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 :(

like image 643
imp Avatar asked Feb 01 '26 16:02

imp


1 Answers

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.

enter image description here

like image 93
albciff Avatar answered Feb 04 '26 06:02

albciff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!