Forum Discussion
Hi,
I encountered same issue, when using test case property for a JSONPath query. It just stops working (returns nothing). Any ideas for a workaround?
For path like this $[*][?(@.displayName==ABCD)]['id'] - property transfer correctly finds the value an puts it to Test Case property, but when I use another test case property instead of explicit string ABCD like this:
$[*][?(@.displayName=="${#TestCase#AccountNumber}")]['id']
it stops working just returns null.
Ivan.
A test case property can be used with JSONPath match assertions and XPath property transfers so JSONPath property transfer should work as well. It seems to be a defect because $ is a special character for JSONPath and property expansion.
Groovy script can be used as a workaround
(removed single quotes around id in JSONPath for this example)
def sourcename = 'source test step name' def propname = 'test case property name' def jsonpath = '$[*][?(@.displayName=="${#TestCase#AccountNumber}")].id' transfervalue = context.expand("\${${sourcename}#Response#${jsonpath}}") context.testCase.setPropertyValue(propname, transfervalue) log.info transfervalue