Ask a Question

getting null pointer exception on file.write while trying to capture results

radhikac57
Occasional Visitor

getting null pointer exception on file.write while trying to capture results

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

1 REPLY 1
nmrao
Community Hero

Re: getting null pointer exception on file.write while trying to capture results

Can you attach the stacktrace from error log?



Regards,
Rao.
cancel
Showing results for 
Search instead for 
Did you mean: