Forum Discussion
groovy script don’t have a response value, they have a result value. You might have to check the step type (e.g. request or groovy script) and then decide whether to look for #response or #result.
Hi Chris,
I am a bit new to groovy and correct me if I am wrong here. Below is the sameple request and response :
Here Add Itinerary is my Test Step Name and which execute 01Y5 command and the line " 1 ET 105Y......" is the response of that command. In my case I am getting result as " Add Itinerary : NULL" means the command is not captured :
Add Itinerary : 01Y5
Add Itinerary : 1 ET 105Y 07JUN M MQXADD SS1 255P 420P /E
ARR-TERMINAL 1
- ChrisAdams4 years agoChampion Level 3
Hi,
Is the below code snippet the part that is not working?
def RSholder = groovyUtils.getXmlHolder(StepName.toString()+"#Response") RSholder.namespaces["xmlns"] = "http://webservices.sabre.com/sabreXML/2003/07" def nodeRS = RSholder.getNodeValue("//xmlns:SabreCommandLLSRS/xmlns:Response")
Do you have other requests that go down this branch and if so, do they return the response?
- dinojadhav4 years agoOccasional Contributor
I guess this is code which is not working :
else{
def RQHolder = groovyUtils.getXmlHolder(StepName.toString()+"#Request")
RQHolder.namespaces["xmlns"] = "http://webservices.sabre.com/sabreXML/2003/07"
def nodeRQ = RQHolder.getNodeValue("//xmlns:SabreCommandLLSRQ/xmlns:Request/xmlns:HostCommand")- ChrisAdams4 years agoChampion Level 3
Hi,
Try this to inspect the request....
def request = testRunner.testCase.testSteps[StepName].testRequest.response.getRequestContent(); log.info request; // Logs full XML Request def stuff = new XmlSlurper().parseText(request); log.info(stuff);
Or, if your payload has multiple items...
def request = testRunner.testCase.testSteps[StepName].testRequest.response.getRequestContent(); def xml = new XmlParser().parseText(request); log.info(xml); for(item in xml){ log.info( item); }
Related Content
- 13 years ago
- 3 years ago
- 12 years ago
Recent Discussions
- 15 years ago