9

The below is my response..

{"activation":{"existing":false, "customer": new}}

Now when I use

testRunner.testCase.getTestStepByName("xxx").getPropertyValue("response")

The above script is extracting the response. Now I wanted to extract "customer" value.

How to do this?

Thanks

chue x
  • 18,573
  • 7
  • 56
  • 70
ChanGan
  • 4,254
  • 11
  • 74
  • 135

1 Answers1

20
import groovy.json.JsonSlurper

responseContent = testRunner.testCase.getTestStepByName("xxx").getPropertyValue("response")
slurperresponse = new JsonSlurper().parseText(responseContent)
log.info (slurperresponse.activation.customer)
chue x
  • 18,573
  • 7
  • 56
  • 70
ChanGan
  • 4,254
  • 11
  • 74
  • 135
  • In addition, I would pass `activation.customer` as a dynamic value, as these values change for different json response. – raje hyd Jun 15 '15 at 09:48