Forum Discussion

bvenku1982's avatar
bvenku1982
Contributor
8 years ago

DataSource with Groovy Script - NullPointerException in SoapUI NG

Steps to reproduce:

In a test case create step Data source > select Groovy script and paste the below script.

Add property as ID

Run the script it works fine

Now Close the data source screen by clicking on cross button

reopen the data source and run the script

you will get the java NullPointerException

 

I hope it will be fixed by soapui NG team

 

 

import org.apache.commons.lang.RandomStringUtils

countryCode = "FR"
decisionCode = "SDE"
charset = (('0'..'9')).join()
randomString = RandomStringUtils.random(8, charset.toCharArray())

result["ID"] = countryCode + decisionCode + randomString

 

 

  • Thu Jun 09 15:30:18 CEST 2016:ERROR:java.lang.NullPointerException
  • java.lang.NullPointerException
    at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.setVariable(SoapUIGroovyScriptEngine.java:147)
    at com.eviware.soapui.impl.wsdl.teststeps.datasource.GroovyDataSource.next(GroovyDataSource.java:73)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlDataSourceTestStep.a(WsdlDataSourceTestStep.java:587)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlDataSourceTestStep.a(WsdlDataSourceTestStep.java:665)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlDataSourceTestStep.next(WsdlDataSourceTestStep.java:675)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.DataSourceDesktopPanel$TestAction.actionPerformed(DataSourceDesktopPanel.java:514)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.DataSourceDesktopPanel$TestAction.actionPerformed(DataSourceDesktopPanel.java:1)
    at com.eviware.soapui.impl.wsdl.actions.iface.AbstractSwingAction.actionPerformed(AbstractSwingAction.java:63)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

8 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3

    Please try with the below marked change.

     

    • bvenku1982's avatar
      bvenku1982
      Contributor

      No it it doesn't work, i have the same error.

      please suggest something.. i am blocked here.

      I will have to close the ReadyAPI to get it work previously but now it is not even displaying the values that are generated

  • nmrao's avatar
    nmrao
    Champion Level 3
    I do not know which version you are on, but I do have 1.5 and your script is working perfect, I can see result.