Forum Discussion

Sandyapitester's avatar
Sandyapitester
Frequent Contributor
8 years ago

how to get and compare the response node value in soapui

Hi All

 

In my response am getting the response node value like 

 

Response value:

 

"StringID":0000111,

"ID":0000111,

 

Need to compare the both response value in groovy scripting,

 

tried the below script

 

def fn = context.expand('${testcase _0#response#*://StringID}')
log.info fn
def fn2 = context.expand('${testcase _0#response#*://"ID"}')

log.info

assert fn == fn2

 

My scripting assertion is pass but no result like

 

Tue Oct 11 18:30:08 IST 2016:INFO:

Tue Oct 11 18:30:08 IST 2016:INFO:

 

 

Plz help me to fix this issue....

 

6 Replies

  • Sandyapitester's avatar
    Sandyapitester
    Frequent Contributor

    tried below the script to validate the node reponse value

     

    def fn = new com.eviware.soapui.support.GroovyUtils(context)
    def fn2 = fn.getXmlHolder(messageExchange.responseContent)
    assert fn2.getNodeValue("//ns1:ID")=="0000111"

     

    Have got below the error message

    error: Unexpected element:CDATA

     

    someone can help me to fix this issue 

    • nmrao's avatar
      nmrao
      Champion Level 3
      Please pay attention to show more details such as response and which values needs to be extracted.
      • Sandyapitester's avatar
        Sandyapitester
        Frequent Contributor

        Rao,

         

        Need to extract the below two response parameter from my testcase

         

        Response parameter and value:

         

        "StringID":0000111,

        "ID":0000111,

         

         

        and need to compare the two parameter values matching or not, 

         

        am looking for this validation in groovy scripting

         

        could u plz help me to fix this issue...