Forum Discussion
Sandeepss
12 years agoOccasional Contributor
Hi Martin,
Thanks a lot for sharing this code.
Here i am facing some error can you any one help me out plz..
Here my flow goes
i have created as per above code a Suite and Class in that as below.... called Library File
class Example
{
def execute(message)
{
context.utils = new com.eviware.soapui.support.GroovyUtils(context)
def response = context.expand( '${GetGeoIP#Response}' )
context.holder = context.utils.getXmlHolder(response)
context.values = context.holder.getNodeValues("//ReturnCode")
return context.values
}
}
context.setProperty( "example", new Example() )
and below is my Calling Script which calls above method execute. as below
library = testRunner.testCase.testSuite.project.testSuites["Library"]
module = library.testCases["LibTestCase"].testSteps["Groovy Script"]
module.run(testRunner, context)
def example = context.example
log.info example.execute("hi")
and when try to exucute i got the below error plz let me know the solution for this and how can i resolve it..
Error as below
Tue Feb 05 11:42:23 IST 2013:ERROR:groovy.lang.MissingPropertyException: No such property: context for class: Example
groovy.lang.MissingPropertyException: No such property: context for class: Example
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at org.codehaus.groovy.runtime.callsite.GetEffectivePogoPropertySite.getProperty(GetEffectivePogoPropertySite.java:86)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
at Example.execute(Script8.groovy:21)
at Example$execute.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:54)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at Script10.run(Script10.groovy:17)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:148)
at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:274)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Thanks a lot for sharing this code.
Here i am facing some error can you any one help me out plz..
Here my flow goes
i have created as per above code a Suite and Class in that as below.... called Library File
class Example
{
def execute(message)
{
context.utils = new com.eviware.soapui.support.GroovyUtils(context)
def response = context.expand( '${GetGeoIP#Response}' )
context.holder = context.utils.getXmlHolder(response)
context.values = context.holder.getNodeValues("//ReturnCode")
return context.values
}
}
context.setProperty( "example", new Example() )
and below is my Calling Script which calls above method execute. as below
library = testRunner.testCase.testSuite.project.testSuites["Library"]
module = library.testCases["LibTestCase"].testSteps["Groovy Script"]
module.run(testRunner, context)
def example = context.example
log.info example.execute("hi")
and when try to exucute i got the below error plz let me know the solution for this and how can i resolve it..
Error as below
Tue Feb 05 11:42:23 IST 2013:ERROR:groovy.lang.MissingPropertyException: No such property: context for class: Example
groovy.lang.MissingPropertyException: No such property: context for class: Example
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at org.codehaus.groovy.runtime.callsite.GetEffectivePogoPropertySite.getProperty(GetEffectivePogoPropertySite.java:86)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
at Example.execute(Script8.groovy:21)
at Example$execute.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:54)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at Script10.run(Script10.groovy:17)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:148)
at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:274)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Related Content
- 4 years ago
- 9 years ago
- 3 years ago
- 7 years ago
- 10 years ago
Recent Discussions
- 3 days ago