Forum Discussion

_ivanovich_'s avatar
_ivanovich_
Frequent Contributor
5 years ago
Solved

In JDBC Step Assertion script throws error encoding UTF-8

Hi,
i have a jdbc step where i get some date frm a table.
i use the Add assertion with script functionnality to compare variables.
So this is code generated:

import com.eviware.soapui.support.XmlHolder
def holder = new XmlHolder( messageExchange.responseContentAsXml )
def addressId = holder.getDomNode( "//Results[1]/ResultSet[1]/Row[1]/v.addressId[1]" )
def project = messageExchange.modelItem.project;
def addressIdFromResponse = project.getPropertyValue("addressId")
assert addressIdFromResponse == addressId

The content xml is like:
Results
ResultSet
@fetchSize
Row
@rowNumber
v.adressId PARIS-CORP

When i run the assertion code it throws:

assert addressIdFromResponse == addressId
| | |
| | PARIS-CORP
| false
<?xml version="1.0" encoding="UTF-8"?>
<v.adressId>PARIS-CORP</v.adressId>



If i log.info addressId

it gives a code like:

  • Fri Mar 01 10:50:40 EST 2020: INFO: org.apache.xmlbeans.impl.store.Xobj$ElementXobj@34b9e639
  • instead of PARIS-CORP

 

  • Problem solved with this modification:

    holder.getDomNode replace with holder.getNodeValue

    please close the thread.

    Thank you

3 Replies

  • _ivanovich_'s avatar
    _ivanovich_
    Frequent Contributor

    Problem solved with this modification:

    holder.getDomNode replace with holder.getNodeValue

    please close the thread.

    Thank you

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thank you for pointing this out Himanshu!

       

      _ivanovich_ it is great to hear that you've found a solution. Thank you for sharing it! 

      I've marked your comment as a solution for this thread.

       

      BTW, feel free to mark helpful comments as solutions in the threads you start, this will 'close' the thread, so to speak:smileyhappy: