Forum Discussion

mtkhan1980's avatar
mtkhan1980
New Contributor
3 years ago

TestSuiteRunListener.afterTestCase

I have a property at the testSuite level (different test suite from the one which is being run in the same project) which I want to use in the TestSuiteRunListener.afterTestCase event. What I am trying to achieve is to insert data in the table, which I am storing the properties.

 

Tried this method but I getting an error

 

def subscriberId = testRunner.testCase.testSuite.project.getTestSuiteByName('getSetAndValidateData').getPropertyValue( "subscriberid" )
log.info("SubscriberId is : "+subscriberId) 

 

 

Error:

  • Wed Oct 20 00:59:11 MDT 2021: ERROR: com.eviware.soapui.support.scripting.ScriptException: Error in TestSuiteRunListener.afterRun
  • com.eviware.soapui.support.scripting.ScriptException: Error in TestSuiteRunListener.afterRun
  • at com.eviware.soapui.eventhandlers.support.DefaultSoapUIEventHandler.invoke(DefaultSoapUIEventHandler.java:31)
  • at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(AbstractEventHandlerMetaData.java:80)
  • at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(AbstractEventHandlerMetaData.java:61)
  • at com.eviware.soapui.eventhandlers.impl.EventHandlersTestSuiteRunListener.afterRun(EventHandlersTestSuiteRunListener.java:38)
  • at com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner$1.notifyListener(WsdlTestSuiteRunner.java:242)
  • at com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner.notifyListeners(WsdlTestSuiteRunner.java:298)
  • at com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner.notifyAfterRun(WsdlTestSuiteRunner.java:239)
  • at com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner.internalFinally(WsdlTestSuiteRunner.java:228)
  • at com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner.internalFinally(WsdlTestSuiteRunner.java:1)
  • at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:154)
  • 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:1130)
  • at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
  • at java.base/java.lang.Thread.run(Thread.java:831)
  • Caused by: groovy.lang.MissingPropertyException: No such property: testCase for class: com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner
  • at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:65)
  • at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:65)
  • at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:329)
  • at Script1.run(Script1.groovy:6)
  • 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.eventhandlers.support.DefaultSoapUIScript.invoke(DefaultSoapUIScript.java:42)
  • at com.eviware.soapui.eventhandlers.support.DefaultSoapUIEventHandler.invoke(DefaultSoapUIEventHandler.java:29)
  • nmrao's avatar
    nmrao
    Champion Level 3
    Please try
    log.info runContext.project.getTestSuiteByName('getSetAndValidateData').getPropertyValue( "subscriberid" )
    • mtkhan1980's avatar
      mtkhan1980
      New Contributor

      thank you! nmrao for helping me on this, but this did not work either 

       

      Error Log:

       

      com.eviware.soapui.support.scripting.ScriptException: Error in TestSuiteRunListener.afterTestCase
      at com.eviware.soapui.eventhandlers.support.DefaultSoapUIEventHandler.invoke(DefaultSoapUIEventHandler.java:31)
      at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(AbstractEventHandlerMetaData.java:80)
      at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(AbstractEventHandlerMetaData.java:61)
      at com.eviware.soapui.eventhandlers.impl.EventHandlersTestSuiteRunListener.afterTestCase(EventHandlersTestSuiteRunListener.java:47)
      at com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner$3.notifyListener(WsdlTestSuiteRunner.java:261)
      at com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner.notifyListeners(WsdlTestSuiteRunner.java:298)
      at com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner.notifyAfterRunTestCase(WsdlTestSuiteRunner.java:258)
      at com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner.runSequential(WsdlTestSuiteRunner.java:190)
      at com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner.internalRun(WsdlTestSuiteRunner.java:134)
      at com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner.internalRun(WsdlTestSuiteRunner.java:1)
      at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:130)
      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:1130)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
      at java.base/java.lang.Thread.run(Thread.java:831)
      Caused by: groovy.lang.MissingPropertyException: No such property: runContext for class: Script9
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:65)
      at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:51)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:341)
      at Script9.run(Script9.groovy:1)
      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.eventhandlers.support.DefaultSoapUIScript.invoke(DefaultSoapUIScript.java:42)
      at com.eviware.soapui.eventhandlers.support.DefaultSoapUIEventHandler.invoke(DefaultSoapUIEventHandler.java:29)
      ... 15 more