When the below script is used for capturing test results in soapui , NullPointerException is thrown at line 12 : File.write()
import com.eviware.soapui.impl.wsdl.testSteps.*
defGroovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def path= testRunner.testCase.testSuite.getPropertyValue("Results_Path")
new File(path).mkdir()
for(testCase in context.testCase.testSuite.getTestCaseList())
{
for(teststep in testCase.getTestStepList())
{
def ts_name = teststep.getName()
def req = teststep.getPropertyValue("Request")
new File(path + "/" + ts_name + "_" + "Request" + ".xml").write(req , "UTF-8")
def res = teststep.getPropertyValue("Response")
new File(path + "/" + ts_name + "_" + "Response" + ".xml").write(res)
}
}
Please help me on how to avoid this NullPointerException