shabar
12 years agoContributor
[Res] Groovy script conext error
Hi
I am trying to execute following script to update headers and running this as a step in one of the test cases
But I am getting following error
To my knowledge this could be a context issue
If so please let me know how it can be fixed and if any links to understand the API design for context change
Cheers
I am trying to execute following script to update headers and running this as a step in one of the test cases
import com.eviware.soapui.impl.wsdl.teststeps.*
def valueOf = { key -> testSuite.getPropertyValue( key ) }
testSuite.testCaseList.each { testCase ->
testCase.testStepList.each { testStep ->
if( testStep instanceof WsdlTestRequestStep || testStep instanceof RestTestRequestStep ) {
def headers = [ (valueOf( "name190" )) : [ valueOf( "ExampleHeaderValue" ) ] ]
log.info("Setting HTTP headers ${headers} in test case ${testCase.label}")
testStep.testRequest.requestHeaders = headers
}
}
}
But I am getting following error
Sat Feb 22 20:38:06 EST 2014:ERROR:groovy.lang.MissingPropertyException: No such property: testSuite for class: Script18
groovy.lang.MissingPropertyException: No such property: testSuite for class: Script18
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
at Script18.run(Script18.groovy:7)
To my knowledge this could be a context issue
If so please let me know how it can be fixed and if any links to understand the API design for context change
Cheers