Forum Discussion

jinisha's avatar
jinisha
New Contributor
10 years ago

Property Transfer - Is it possible to use test case custom property in jsonpath expression textbox?

I get data from an API in json format. 

 

I am wondering if I can do something like this to filter the data that I get in response. Currently its not working. 

 

For ex;

$.Refinements[?(@.RefinementText=='${#TestCase#VehicleType}')] .RefinementValue

 

If I use $.Refinements[?(@.RefinementText== ‘Auto/Light Trucks’)] .RefinementValue it works however, I need to compare RefinementText with the custom property that I have defined in the test case.

 

Please advise where can I find more information on how to handle this.

 

Thanks!

8 Replies

    • CoreBit's avatar
      CoreBit
      New Contributor

      Hi,

       

      I have got the same issue with property expansion inside JSONPath:

       

      I have a custom property "Property_Name" with value "Property_Value" in the TestSuite.

       

      Inside a transfer step I want to use it like this:

      $.response.data[?(@.label=='${#TestSuite#Property_Name}')]

      It does not work, result is [[]].

      But when I specify the value like in the following expression, then I get my desired result:

      $.response.data[?(@.label=='Property_Value')]

      Is property expansion inside JSONPath not possible at all or am I doing it wrong?

       

      Regards,

      Adam

      • nmrao's avatar
        nmrao
        Champion Level 3
        Is it possible for you to post the raw response?