roryLIT
11 years agoContributor
[Resolved] Pass a variable into context.expand code
I have a script assertion in a teststep. I want to get the response xml from the previous step to parse. The code to do this is currently like this:
def currentTestStep = context.getCurrentStep().getLabel()
def currentStepInd = context.currentStepIndex
def previousTestStep = context.testCase.getTestStepAt(currentStepInd - 1)
previousTestStep = previousTestStep.name
def response = context.expand( '${previousTestStep#ResponseAsXml#//Row[1]}' )
def records = new XmlSlurper().parseText(response)
Have I passed the previousTestStep variable in correctly?
Thanks
def currentTestStep = context.getCurrentStep().getLabel()
def currentStepInd = context.currentStepIndex
def previousTestStep = context.testCase.getTestStepAt(currentStepInd - 1)
previousTestStep = previousTestStep.name
def response = context.expand( '${previousTestStep#ResponseAsXml#//Row[1]}' )
def records = new XmlSlurper().parseText(response)
Have I passed the previousTestStep variable in correctly?
Thanks