Getting null value from holder.getNodeValue while the properties has value in it.
Error at assertion: Incorrect Service Type. Expression: (ServiceTypeResponse == ServiceTypeExcel). Values: ServiceTypeResponse = null, ServiceTypeExcel = Air
Namespace ns2 is correctly defined.
This is the complete groovyscript.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder(messageExchange.getResponseContent())
def namespace = holder.declareNamespace('ns2', "http://sita.aero/iborders/external/EventServiceWSDLTypes/V12")
def ServiceTypeResponse = holder.getNodeValue("//ns2:SearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/ExpectedService/ServiceType")
def ServiceCodeResponse = holder.getNodeValue("//ns2:SearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/ExpectedService/ServiceCode")
def ServiceNumberResponse = holder.getNodeValue("//ns2:SearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/ExpectedService/ServiceNumber")
def ServiceRouteResponse = holder.getNodeValue("//ns2:SearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/ServiceRoute")
def DeparturePortResponse = holder.getNodeValue("//ns2:SearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/DeparturePort")
def ArrivalPortResponse = holder.getNodeValue("//ns2:SearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/ArrivalPort")
def GenderResponse = holder.getNodeValue("//ns2:SearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/Identity/Gender")
def TravelDocumentTypeResponse = holder.getNodeValue("//ns2:SearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/Identity/TravelDocument/Type")
def TravelDocumentNumberResponse = holder.getNodeValue("//ns2:SearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/Identity/TravelDocument/Number")
def TravelDocumentIssueCountryResponse = holder.getNodeValue("//ns2:SearchExpectedMovementsResponse//ns2:ExpectedMovementEvent/Identity/TravelDocument/IssueCountry")
def SuccessResponse = holder.getNodeValue("//ns2:SearchExpectedMovementsResponse//ns2:ReturnCode/Type")
def ServiceTypeExcel = context.expand('${Properties#ServiceType}')
def ServiceCodeExcel = context.expand( '${Properties#ServiceCode}' )
def ServiceNumberExcel = context.expand( '${Properties#ServiceNumber}' )
def ServiceRouteExcel = context.expand( '${Properties#ServiceRoute}' )
def DeparturePortExcel = context.expand( '${Properties#DeparturePort}' )
def ArrivalPortExcel = context.expand( '${Properties#ArrivalPort}' )
def GenderExcel = context.expand( '${Properties#Gender}' )
def TravelDocumentTypeExcel = context.expand( '${Properties#DocumentType}' )
def TravelDocumentNumberExcel = context.expand( '${Properties#DocumentNumber}' )
def TravelDocumentIssueCountryExcel = context.expand( '${Properties#DocumentIssueCountry}' )
assert(ServiceTypeResponse == ServiceTypeExcel): "Incorrect Service Type"
assert(ServiceCodeResponse == ServiceCodeExcel): "Incorrect Service Code"
assert(ServiceNumberResponse == ServiceNumberExcel): "Incorrect Service Number"
assert(ServiceRouteResponse == ServiceRouteExcel): "Incorrect Service Route"
assert(DeparturePortResponse == DeparturePortExcel): "Incorrect Departure Port"
assert(ArrivalPortResponse == ArrivalPortExcel): "Incorrect Arrival Port"
assert(GenderResponse == GenderExcel): "Incorrect Gender"
assert(TravelDocumentTypeResponse == TravelDocumentTypeExcel): "Incorrect Travel Document Type"
assert(TravelDocumentNumberResponse == TravelDocumentNumberExcel): "Incorrect Travel Document Number"
assert(TravelDocumentIssueCountryResponse == TravelDocumentIssueCountryExcel): "Incorrect Travel Document Issue Country"
assert(SuccessResponse == "Success"): "Success Not Present in Response"
ServiceTypeResponse is not getting data from your response. Update it and it will work fine
Do like if you find it as solution!!
Thanks,
Himanshu