spartanhooah
8 years agoOccasional Contributor
getContentAsXml() gives null pointer
I have a fairly simple test case with three test steps:
- Groovy script that acts as a driver, calling the other two steps as necessary.
- Request step A
- Request step B
The driver calls request step A, does some processing, then calls step B. If I run the driver by itself, everything is fine. But if I execute the test case, the driver crashes when trying to parse the response from step A. Here is how I'm getting the response content:
responseXml = testRunner.runTestStepByName("MarketTimeRequest").getResponse() responseBody = new XmlSlurper().parseText(responseXml.getContentAsXml()).Body
When I run the test case, I get a NullPointerException at responseXml.getContentAsXml(), with the message "Cannot invoke ... on null object". Why would the responseXml be null when running the test case, but not when running the driver?