vijaykorde
10 years agoNew Contributor
How to get a groovy variable in a REST request?
I have a groovy script that defines multiple varibles, and I want to grab the variables in REST request. How can I do this?
Example:
GS_Example
def var1="1"
def var2="2"
REST_Ex...
- 10 years agoI believe that you will not be able to access the variable that is defined in the groovy script step in other steps. Instead, you need to set the value of the variable to test case property so that can be accessed in any step.
In groovy script step:
context.testCase.setPropertyValue('PROPERTY_NAME', 'PROPERTY_VALUE')
In the request steps that can be accessible by:
${#TestCase#PROPERTY_NAME}