Forum Discussion

NehaSharma's avatar
13 years ago

Groovy script in Soap UI

Hi,
Actually im new to soap UI. I needed a help to write a groovy script in which the test case should pass even if that status is Passed or Failed. That is if the response file is any one among the below pasted then it should be passed else failed.
So i wanted to know whether we can use a OR operator in groovy script?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<qcs:QAS_QUERY_SAVE_RESP_MSG xmlns:qcs="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERY_SAVE_RESP_MSG.VERSION_1">
<INFO_MESSAGE>Query QAS_BetweenCritQry exists. Please choose another name.</INFO_MESSAGE>
<STATUS>Failure</STATUS>
</qcs:QAS_QUERY_SAVE_RESP_MSG>
</soapenv:Body>
</soapenv:Envelope>[/color]

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<qcs:QAS_QUERY_SAVE_RESP_MSG xmlns:qcs="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERY_SAVE_RESP_MSG.VERSION_1">
<INFO_MESSAGE>Query QAS_qryWithMax saved successfully.</INFO_MESSAGE>
<STATUS>Success</STATUS>
</qcs:QAS_QUERY_SAVE_RESP_MSG>
</soapenv:Body>
</soapenv:Envelope>

1 Reply

  • nmrao's avatar
    nmrao
    Community Hero
    Hi,

    Do you want to compare entire content you shown above? or you want to do xpath assertion ?
    For instance: below xpath should return true

    (//STATUS/text()='Failure') or (//STATUS/text()='Success')


    Any way, you should be able to use OR operator to assert as shown above.

    Regards,
    Rao.