Forum Discussion
Select the source test step and source property = response.
You can select the path language JSONPath, but in this case the Xpath/JSONPath selection field should be blank otherwise the the property transfer will fail with Invalid JSON error.
The response can be transferred without using JSONPath selection but the value will include the quotation marks.
Thank you for your response. But response which I send as json request which getting failed due to format. How to trim my json values ?
Actual Results: "LocalDateTime": "\"2017-05-17T15:20:51.1117456Z\"",
Expected Results: "LocalDateTime": "2017-05-17T15:20:51.1117456Z",
- HKosova8 years agoSmartBear Alumni (Retired)
In this case Property Transfer transfers the entire response contents, including the quotes around the value. To transfer the unquoted value, you need to use a Groovy script instead.
For example, you can extract the value to a test case property named timestamp:
// Replace "Test Step 1" with your test step name
def value = testRunner.testCase.testSteps["Test Step 1"].testRequest.response.responseContent // remove the enclosing quotes value = value.replaceAll('^"|"$', '') testRunner.testCase.setPropertyValue("timestamp", value)and in the second request, use
${#TestCase#timestamp}
- saftron8 years agoOccasional Contributor
Thank you. I will incorporate scripts and let you know feedback.
Related Content
- 10 months ago
- 5 years ago
Recent Discussions
- 15 years ago