Forum Discussion

vissie1983's avatar
vissie1983
New Contributor
7 years ago

Validate assertion with XPath field null

Hi all. I am new with soap so please bear with me. in the pro-version I created and assetion to match  "content" from a Datasource. It match 100% if there are any details in the field. but when...
  • Aplis's avatar
    Aplis
    7 years ago

    i have similar issue but with JDBC and i got my Groovy script to work.  this is what i have so far. below is link to my post

     

    https://community.smartbear.com/t5/SoapUI-Pro/Compare-EMPTY-TAGS-in-JDBC-response-to-NULL-in-DataSource-as/m-p/174135/thread-id/39693

     

     This groovy works. try it..

     

    def ActualSourceCode = context.expand( '${ABC_XYZ#ResponseAsXml#//Results[1]/ResultSet[1]/Row[1]/SOURCE_CODE[1]}' )
    log.info "JDBCSourceCode= $ActualSourceCode"


    def ExpectedSourceCode = context.expand( '${DataSource#SourceCode1}' )
    log.info "EXCELSourceCode= $ExpectedSourceCode"


    if(ActualSourceCode == 'NOVALUE')
    {

    ExpectedSourceCode = 'NOVALUE'
    assert ExpectedSourceCode == ActualSourceCode
    log.info "SourceCodeNotEntered = $ActualSourceCode"
    }
    else
    {
    assert ExpectedSourceCode == ActualSourceCode
    log.info "SourceCodeEntered = $ActualSourceCode"
    }