Property Transfer - Suite of test steps
- 4 years ago
The code snippet, which I gave earlier, it shouldn't go into property transfer step,
we have to insert a groovy step after your REST request call and paste that code, do necessary modifications as per your project(Ex: Name changing etc..)
Code:
//import library to parse JSON
import groovy.json.JsonSlurperdef response = testRunner.testCase.getTestStepByName("OpenCalaisRequest").getPropertyValue("Response")
def responseJSON = new JsonSlurper().parseText(response)//verify the slurper isn't empty
assert!(responseJSON.isEmpty())testRunner.testCase.setPropertyValue("finchresponseJSON",responseJSON.toString().replaceAll("\\{", "\n"))
Use "finchresponseJSON" from testcase level into your next request. it looks like ${#TestCase#finchresponseJSON}, so it passes your whole JSON response without "{ and }"