Forum Discussion

Astr0x's avatar
Astr0x
Occasional Contributor
16 years ago

Query and problems on soap ui pro test steps

Hi,

I have a testsuite with testcase and with the following test steps:

Test Step 1: Groovy script
Test step 2: Datasource test step (disabled)
Test step 3: Request test step (disabled)
Test Step 4: Property Transfer (disabled)
Test step 5: Data sink (disabled)
Step 2 to 5 is disabled because I make use of the groovy script to run them.

The groovy script will do the following:
   do a iteration of say 2 times{

      a. run datasource test step
      b. run request test step
      c. run transfer property step
      d. run datasink step

}

Detailed explanation on the relationship of step a to d:
For the datasource test step, it will retrieve a record from db and its record values will be passed to the request test step.
For the request test step, it will fire a request and get a respond.
The response value would then be transferred to the datasink test step using the property transfer test step.
The datasink test step will be inserting or updating the response value to the DB.
This sequence should be done 2 times.

Question 1:
When I run the testrunner, it was throwing a NullpointerException error on datasource step(which means it did not execute the step), why is it so?

Question 2 (which link to Question 1):
If I never use the testrunner, I run the groovy script manually it will execute all my teststeps that is called in the groovy script. However, instead of executing step a to d in sequence 2 times, it execute each step 2 times. Why is it so? Also, why running the testrunner it will not work but if I run the groovy script it will?

Kindly reply to my questions and also how should I go upon resolving this problem?

Thanks.

3 Replies

  • Hi!

    can you please show:

    1) the error stacktrace for the NPE
    2) the groovy script you have created

    ?

    regards!

    /Ole
    eviware.com
  • Astr0x's avatar
    Astr0x
    Occasional Contributor
    Hi Ole,

    Thanks for the prompt reply.

    As requested.

    For (1):

    10:05:04,590 INFO  [SoapUIProTestCaseRunner] running step [getEachClassofService]
    java.lang.NullPointerException
    at com.eviware.soapui.impl.wsdl.panels.teststeps.support.NamedParameterStatement.(NamedParameterStatement.java:49)
    at com.eviware.soapui.impl.wsdl.teststeps.datasource.DBDataSource.load(SourceFile:128)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlDataSourceTestStep.next(SourceFile:498)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlDataSourceTestStep.run(SourceFile:138)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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:129)
    at Script1.run(Script1.groovy:4)
    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.testcase.WsdlTestCaseRunner.runTestStep(WsdlTestCaseRunner.java:194)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(WsdlTestCaseRunner.java:125)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(WsdlTestCaseRunner.java:39)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:138)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.start(AbstractTestRunner.java:81)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.run(WsdlTestCase.java:581)
    at com.eviware.soapui.tools.SoapUITestCaseRunner.runTestCase(SoapUITestCaseRunner.java:489)
    at com.eviware.soapui.SoapUIProTestCaseRunner.runTestCase(SourceFile:168)
    at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:318)
    at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:138)
    at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:80)10:05:04,714 ERROR [WsdlDataSinkTestStep] java.lang.NullPointerException

    at com.eviware.soapui.SoapUIProTestCaseRunner.main(SourceFile:48)
    java.lang.NullPointerException
    at com.eviware.soapui.impl.wsdl.panels.teststeps.support.NamedParameterStatement.(NamedParameterStatement.java:49)
    at com.eviware.soapui.impl.wsdl.teststeps.datasource.DBDataSource.load(SourceFile:128)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlDataSourceTestStep.next(SourceFile:498)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlDataSourceTestStep.run(SourceFile:138)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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.AbstractCallSite.call(AbstractCallSite.java:129)
    at Script1.run(Script1.groovy:4)
    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.testcase.WsdlTestCaseRunner.runTestStep(WsdlTestCaseRunner.java:194)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(WsdlTestCaseRunner.java:125)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(WsdlTestCaseRunner.java:39)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:138)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.start(AbstractTestRunner.java:81)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.run(WsdlTestCase.java:581)
    at com.eviware.soapui.tools.SoapUITestCaseRunner.runTestCase(SoapUITestCaseRunner.java:489)
    at com.eviware.soapui.SoapUIProTestCaseRunner.runTestCase(SourceFile:168)
    at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:318)
    at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:138)
    at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:80)
    at com.eviware.soapui.SoapUIProTestCaseRunner.main(SourceFile:48)
    10:05:04,823 ERROR [WsdlDataSinkTestStep] java.lang.NullPointerException
    10:05:04,823 INFO  [SoapUIProTestCaseRunner] Finished running soapUI testcase [TestCase], time taken: 5714ms, status: FINISHED
    10:05:04,823 INFO  [SoapUIProTestCaseRunner] TestCase [TestCase] finished with status [FINISHED] in 5714ms

    In the error log, it states:

    Status: FAILED
    Time taken: 78
    Size: 0
    Timestamp: Thus May 06 09:58:58 SGT 2010
    Teststep: getEachClassofService
    Error: java.lang.NullPointException: Cannot invoke method run() on null object

    ---------------------------Messages--------------
    Cannot invoke method run() on null object


    For (2):

    In the groovy script:

    for (int i=0; i < 2; i++){

    testRunner.testCase.getTestStepByName("TEST_DS").run(testRunner,context);
    testRunner.testCase.getTestStepByName("TEST - Request 1").run(testRunner,context);
    testRunner.testCase.getTestStepByName("TEST_Prop_Transfer").run(testRunner,context);
    testRunner.testCase.getTestStepByName("DataSink").run(testRunner,context);

    }

    Thanks.
  • Astr0x's avatar
    Astr0x
    Occasional Contributor
    Hi Ole,

    To add on the problem I encountered, I realised if I did not run the DataSource test step before, if I execute the groovy script to run the DataSource test step, it will not work.

    Thanks.