Groovy: Fails to Display Request Status
I am building a Groovy script to read an external file and execute a testStep one by one.
Somehow log.info can successfully display the data (basicMSISDN, NAM, etc) of the XML response but not the request status. In log.info, resultCode=Null and message=Null.
Not sure what to do to get the resultCode so I have a log file for tracking.
Thanks.
------------------------------------------------------------------------------------------------------------------------------------
My Groovy script:
...
def xmlResponse = tStep.getPropertyValue("Response")
def holder = groovyUtils.getXmlHolder(xmlResponse)
def MESSAGE11 = holder.getNodeValue("/soap:Envelope/soap:Body/ns2:getImsiDataResponse/resultCode")
def MESSAGE12 = holder.getNodeValue("/soap:Envelope/soap:Body/ns2:getImsiDataResponse/message")
def MESSAGE1 = holder.getNodeValue("/soap:Envelope/soap:Body/ns2:getImsiDataResponse/imsiData/basicMsisdn")
def MESSAGE2 = holder.getNodeValue("/soap:Envelope/soap:Body/ns2:getImsiDataResponse/imsiData/serviceProfile/nam")
def MESSAGE3 = holder.getNodeValue("/soap:Envelope/soap:Body/ns2:getImsiDataResponse/imsiData/serviceProfile/roamingProfileId")
def MESSAGE4 = holder.getNodeValue("/soap:Envelope/soap:Body/ns2:getImsiDataResponse/imsiData/serviceProfile/odbProfileId")
log.info " Seq="+i+" "+data[0]+"| Result: "+MESSAGE1+", "+MESSAGE2+", "+MESSAGE3+", "+MESSAGE4+" "+MESSAGE11+" "+MESSAGE12
...
-----------------------------------------------------------------------------------------------------------------------------------------------
Response of the testStep:
<<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getImsiDataResponse resultCode="0" message="success" xmlns:ns2="http://www.netnumber.com/titan/sdm/soap/types">
<imsiData imsi="302330000006120">
<basicMsisdn>14313140097</basicMsisdn>
<serviceProfile>
<nam>csps</nam>
<transferOfSm>cs</transferOfSm>
<roamingProfileId>320</roamingProfileId> ...
---------------------------------------------------------------------------------------------------------------------------------------------------
Great to hear that the problem is solved.
Actually, .RefreshMappingInfo() method is mentioned in the documentation article that you referenced in your initial message 😉
Just as a side note: TestComplete provides a really good, correct and descriptive documentation that definitely worth detailed reading.