Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 21061

context, log, runner classes to import in groovy

$
0
0

I'm writing some groovy classes (scripts) in a script library that I call from other groovy scripts within ReadyAPI. I pass in the context, log, and runner variables from ReadyAPI when I instantiate a class, so that I have access to all the variables from the running test. 

 

Everything works fine (because groovy is so groovy), and I don't need to define imports for whatever classes those variables are -- groovy figures it out. But, now that I'm setting up these classes in a proper Eclipse project, I'd like to have access to the methods and properties on those objects, so I'd need to know what classes those variables represent.

 

Make sense? I'm a little confused by the object hierarchy, and can't figure out which of the numerous context and runner classes I should import. I tried, for example, importing com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext and com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner, but when I instantiate that class, I get an error. If I remove the imports, it works fine, so obviously this is the wrong class (I'm calling this from within a test step, if that matters). This is the error I get:

 

org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '{ThreadIndex=0, log=org.apache.log4j.Logger@41c133e7, RunCount=0, ExecutionID=90ace2cd-ef7b-4654-804a-450c947d2c15}' with class 'com.eviware.soapui.impl.wsdl.panels.support.MockTestRunContext' to class 'com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext' due to: org.codehaus.groovy.runtime.metaclass.MethodSelectionException: Could not find which method () to invoke from this list: public com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext#(com.eviware.soapui.model.testsuite.TestCaseRunner, com.eviware.soapui.support.types.StringToObjectMap, com.eviware.soapui.model.TestModelItem) public com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext#(com.eviware.soapui.model.testsuite.TestStep) error at line: 3

 

Note that I'm not importing any log class (mainly because I can't figure out which one to use). 

 

Any help is appreciated -- I couldn't find any info about this in the forums, which was surprising. 

 


Viewing all articles
Browse latest Browse all 21061

Trending Articles