scripting groovy TestSuite Variable REST
I do this in all my SOAP messages to store TestSuite Variable and it works perfectly. However, when I apply the same logic to REST. It doesn't work.
myTransactionId ='1234'
suite = context.getParentContext().getParentContext();
TS_Var = "uniqueId"
myVar = suite.get(TS_Var);
suite.put(TS_Var, myTransactionId )
I notice that the call on context.getParentContext() does return a value but it's not related to the scenario case at all. Am I missing something or I should apply a different method call on REST.
Comments
-
Any particular reason why you don't just do context.setValue(TS_Var, myTransactionId)? This will find the variable from the correct context automatically.
0 -
there's another element within the same request. That would be either have the same value or unique value created. Futhermore, I would also like to call it on globally on a method call
0 -
You are only asking about accessing a test suite variable, isn't this correct? The "setValue" and "getValue" methods are what you should use for getting and setting test suite variables. Those methods automatically locate the test suite where you previously defined the variable (on the suite's "Variables" tab).
0 -
You are absolutely right Ben. Thanks.
0