Reputation: 1
In SaopUI in order to validate REST response I used validation with'script assertion' which gives 'true' or 'false' output result as I expect but the assertion itself is always 'PASSED'. My intention is to FAIL the asssertion on the output result 'failure'. Perhaps anyone can help me with that?
This is the script which gives me result "failure" on value '1.99'. So all I'd like to do is to FAIL assetion on this result.
def responseAsText = context.expand( '${GePurchases#ResponseAsXml#declare namespace ns1=\'urn:traces:reporting:2.0\'; //ns1:Purchases[1]}' )
def responseParser = new XmlParser().parseText(responseAsText)
def lastElement = responseParser.Purchase.last()
def PurchasePrice = lastElement.PurchasePrice
def PriceInVat = lastElement.PurchasePrice.@inVat[0] == '1.99'
Thanks in advance
Upvotes: 0
Views: 599
Reputation: 65
The comparison is done by the 'assert' argument
assert <your value> == <response>
Upvotes: 1