import groovy.json.JsonSlurper
def testStepName = 'Adding_Users'
def jsonSlurper = new JsonSlurper()
def response = context.expand('$(testStepName#Response)')
def usersInfomration = jsonSlurper.parseText(response)
String userName = userInformation.name
log.info UserName
Asked
Active
Viewed 90 times
0

daggett
- 26,404
- 3
- 40
- 56

pridhvimallikharjun
- 29
- 1
- 2
-
Means `context.expand('$(testStepName#Response)')` failed to expand value. Check that `testStepName` is valid. And as I remember it should be in curly brackets: `context.expand('${testStepName#Response}')`. – daggett Oct 10 '19 at 16:40
-
Thanks you .curly brackets works. But I am facing another error "text must not be null" at line 8 – pridhvimallikharjun Oct 11 '19 at 05:51
-
so your text is null. again: check the step name you using – daggett Oct 11 '19 at 09:42
-
as i can see by picture, th step name with rest has name `Adding_Users`. so, to access response from this step you have to use `'${Adding_Users#Response}'` – daggett Oct 11 '19 at 09:45