Forum Discussion

HaroldR's avatar
HaroldR
Contributor
8 years ago

How to use $ to populate variable inside another $expression

Hello,  I am trying to populate a variable value inside a $ Expression inside my groovyscript: def currentStepInd = context.currentStepIndex; def previousStep = testRunner.testCase.getTestStepAt(...
  • groovyguy's avatar
    8 years ago

    Try this:

     

     

    def currentStepInd = context.currentStepIndex;
    def previousStep = testRunner.testCase.getTestStepAt(currentStepInd - 2)
    def previousStepName = previousStep.name;
    def response = context.expand( '${' + previousStepName + '#Response}' );
    context.testCase.setPropertyValue("Response", response);