Forum Discussion
Pallavibhaskar
15 years agoOccasional Contributor
Hi Deepesh,
Thank you very much for the quick response, I tried the following, with the help of your code.
----------------------------------------------------------------------------------------------------------------------------
def utils = new com.eviware.soapui.support.GroovyUtils( context );
def project = testRunner.testCase.testSuite.project ;
def tcase = project.testSuites["recordedViewingsReports"].testCases["singleRecordedViewingForIntegratedChannel"] ;
def tstep = tcase.getTestStepByName("assert-getDeliveredViewingReports");
def response_holder = tstep.getProperty("response");
def holder = utils.getXmlHolder("$response_holder");
----------------------------------------------------------------------------------------------------------------------------
The groovy script failed at the last step "def holder = utils.getXmlHolder("$response_holder");" , it returned me a java null pointer exception.
Please find the error logs below:
----------------------------------------------------------------------------------------------------------------------------
Fri Nov 04 14:34:06 GMT 2011:ERROR:java.lang.NullPointerException
java.lang.NullPointerException
at com.eviware.soapui.support.XmlHolder.<init>(XmlHolder.java:52)
at com.eviware.soapui.support.GroovyUtils.getXmlHolder(GroovyUtils.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
at Script11.run(Script11.groovy:11)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:148)
at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:274)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Thank you very much for the quick response, I tried the following, with the help of your code.
----------------------------------------------------------------------------------------------------------------------------
def utils = new com.eviware.soapui.support.GroovyUtils( context );
def project = testRunner.testCase.testSuite.project ;
def tcase = project.testSuites["recordedViewingsReports"].testCases["singleRecordedViewingForIntegratedChannel"] ;
def tstep = tcase.getTestStepByName("assert-getDeliveredViewingReports");
def response_holder = tstep.getProperty("response");
def holder = utils.getXmlHolder("$response_holder");
----------------------------------------------------------------------------------------------------------------------------
The groovy script failed at the last step "def holder = utils.getXmlHolder("$response_holder");" , it returned me a java null pointer exception.
Please find the error logs below:
----------------------------------------------------------------------------------------------------------------------------
Fri Nov 04 14:34:06 GMT 2011:ERROR:java.lang.NullPointerException
java.lang.NullPointerException
at com.eviware.soapui.support.XmlHolder.<init>(XmlHolder.java:52)
at com.eviware.soapui.support.GroovyUtils.getXmlHolder(GroovyUtils.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
at Script11.run(Script11.groovy:11)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:148)
at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:274)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)