Forum Discussion

muralidhar7's avatar
muralidhar7
Occasional Contributor
12 years ago

trying to call one groovy script from other using testrunner

i am trying to call one groovy script from other using testrunner but it is failing with nullpointer exception can any one help me on this
i am calling like this:
testRunner.runTestStepByName("GetOffersDetails_script")

error i got:

Fri May 09 22:25:00 EDT 2014:ERROR:java.lang.NullPointerException
java.lang.NullPointerException
at com.eviware.soapui.impl.wsdl.panels.support.MockTestRunner.runTestStepByName(MockTestRunner.A:68)
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:117)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at Script1.run(Script1.groovy:12)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:93)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:51)
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:619)

can any one please help

7 Replies

  • muralidhar7's avatar
    muralidhar7
    Occasional Contributor
    Fri May 09 22:35:41 EDT 2014:ERROR:java.lang.NullPointerException
    java.lang.NullPointerException
    at com.eviware.soapui.impl.wsdl.panels.support.MockTestRunner.runTestStepByName(MockTestRunner.java:68)
    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:117)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
    at Script4.run(Script4.groovy:12)
    at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:93)
    at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:51)
    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:619)
  • muralidhar7's avatar
    muralidhar7
    Occasional Contributor
    muralidhar7 wrote:
    i am trying to call one groovy script from other using testrunner but it is failing with nullpointer exception can any one help me on this
    i am calling like this:
    testRunner.runTestStepByName("GetOffersDetails_script")

    error i got:

    Fri May 09 22:25:00 EDT 2014:ERROR:java.lang.NullPointerException
    java.lang.NullPointerException
    at com.eviware.soapui.impl.wsdl.panels.support.MockTestRunner.runTestStepByName(MockTestRunner.A:68)
    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:117)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
    at Script1.run(Script1.groovy:12)
    at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:93)
    at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:51)
    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:619)

    can any one please help
  • muralidhar7's avatar
    muralidhar7
    Occasional Contributor
    no one knows groovy in this forum?

    please help on above issue
  • jurek's avatar
    jurek
    New Contributor
    Maybe try to go to your testStep by full way like this:
    def tr = testRunner.testCase.testSuite.project.testSuites["TestSuitName"].testCases["TestCaseName"].testSteps["TestStepName"]
  • PaulDonny's avatar
    PaulDonny
    Regular Contributor
    muralidhar7,

    The nullPointerException is originating from the script not being able to find "GetOffersDetails_script"

    Try and do the following script and see what the results are:

    log.info testRunner.getTestStepByName("GetOffersDetails_script") 


    It will fail. Next try the following script:

    log.info testRunner.testCase.getTestStepByName("GetOffersDetails_script")


    If the script is in the same testCase this will not fail. From testRunner you have to access the correct location of your script. If it's in a different testCase, you have to go up to your testSuite level and then get the correct testCase and then run the testStep. If in a different testSuite, go to project level. If in a different project, go to workspace level, if in a different workspace just build it in as an extension.

    I hope this helps you a bit with future endeavors with groovy.