mikek
15 years agoNew Contributor
Context won't expand certain properties inside a Groovy class
Hi,
I'm trying to do a REST request which calls a groovy class for one of it's parameters, the call looks like this:
The context which is passed is the DefaultPropertyExpansionContext.
Inside the Groovy class's method I need to access the request parameters, but some of them require expansion.
This is where I get stuck, since if I try to expand the property I get nothing.
The context will only expand properties on the project level, but not any lower (TestCase/TestSuite).
Example from the script:
Which prints out:
Please advise as to how this can be done.
Regard,
Mike
I'm trying to do a REST request which calls a groovy class for one of it's parameters, the call looks like this:
${=MyClass.call("${#Project#property}", request, context, log)}
The context which is passed is the DefaultPropertyExpansionContext.
Inside the Groovy class's method I need to access the request parameters, but some of them require expansion.
This is where I get stuck, since if I try to expand the property I get nothing.
The context will only expand properties on the project level, but not any lower (TestCase/TestSuite).
Example from the script:
log.info(s + "=" + request.getPropertyValue(s))
log.info(s + "=" + context.expand("'" + request.getPropertyValue(s))+ "'")
Which prints out:
Tue Apr 13 09:40:56 IDT 2010:INFO:method=activateContent
Tue Apr 13 09:40:56 IDT 2010:INFO:method='activateContent'
Tue Apr 13 09:40:56 IDT 2010:INFO:msisdn=${#TestCase#phoneNumber}
Tue Apr 13 09:40:56 IDT 2010:INFO:msisdn=''
Tue Apr 13 09:40:56 IDT 2010:INFO:operator_id=${#TestSuite#operatorId}
Tue Apr 13 09:40:56 IDT 2010:INFO:operator_id=''
Please advise as to how this can be done.
Regard,
Mike