Forum Discussion

kannan's avatar
kannan
Occasional Contributor
3 years ago
Solved

NullPointerException at com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep

 

I am stuck with below error . I am calling a groovy test step from assertion of a Test Step and this groovy test step is calling another test case . it is running but below exception is coming .

 

Just sample code .

 

Test Step 1 - >  In assertion calling another test step based on some conditions

     context.testCase.getTestStepByName("VerifyAddress").run(context.testRunner,context)

 

Test step 2 (VerifyAddress)

      //calling another step based on few conditions

     def key = context.testCase.testSuite.project.testSuites['Keywords_Addresses'].testCases['ApproveAdress']

     key.setPropertyValue("city",city)

     def runner = key.run( null, true )
     runner.waitUntilFinished()

 

Thu Apr 29 22:53:32 IST 2021: ERROR: java.lang.NullPointerException java.lang.NullPointerException at com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep.run(RestTestRequestStep.java:921) at com.eviware.soapui.model.testsuite.TestStep$run$0.call(Unknown Source) at Script7.run(Script7.groovy:14) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:94) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:83) at com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion.assertScript(GroovyScriptAssertion.java:150) at com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion.internalAssertResponse(GroovyScriptAssertion.java:186) at com.eviware.soapui.impl.wsdl.teststeps.WsdlMessageAssertion.assertResponse(WsdlMessageAssertion.java:164) at com.eviware.soapui.impl.wsdl.teststeps.RestTestRequest.assertResponse(RestTestRequest.java:150) at com.eviware.soapui.impl.wsdl.teststeps.RestTestRequest.setResponse(RestTestRequest.java:141) at com.eviware.soapui.impl.support.panels.AbstractHttpRequestDesktopPanel.afterSubmit(AbstractHttpRequestDesktopPanel.java:606) at com.eviware.soapui.impl.wsdl.panels.teststeps.RestTestRequestDesktopPanel.afterSubmit(RestTestRequestDesktopPanel.java:365) at com.eviware.soapui.impl.wsdl.WsdlSubmit.notifyListenersAfterSubmit(WsdlSubmit.java:111) at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:157) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:835)

  • If I were into your shoes, I would use the script assertion itself (my understanding is that call a groovy script from script assertion) and not call another groovy script. And also avoid having dependency on another test case.

    Please check if it is possible to re-design the test to be independent.

    Is it possible to crate sample project to reproduce the issue?

4 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    If I were into your shoes, I would use the script assertion itself (my understanding is that call a groovy script from script assertion) and not call another groovy script. And also avoid having dependency on another test case.

    Please check if it is possible to re-design the test to be independent.

    Is it possible to crate sample project to reproduce the issue?
  • kannan : I agree with nmrao , the approach which you are using doesn't looks good as :

     

    1. All the test steps should be independent and

    2. Calling a test step from a script assertion is not a good decision.

     

    You should move the logic of calling another test step to a separate groovy script


    Let me know in case more help is needed, would be happy to help ğŸ™‚

     

    • kannan's avatar
      kannan
      Occasional Contributor
      Yea ! I have already moved it to a different test step but I just wanted to
      understand why it is throwing this error .
      • nmrao's avatar
        nmrao
        Champion Level 3
        Not possible to comment without the code written in script assertion and groovy script test step.