Forum Discussion

vijayatamma's avatar
vijayatamma
New Contributor
8 years ago

Property transfer test step - cannot use project/test case level properties in the JSON Path

Hi

 

I am trying to use project level property in JSON path for the source in a property transfer test step, but the value of the property is not substituted when I execute the step.

 

eg: $..books[?(@.book.name=='${#Project#bookName}')].author[0]

 

But when I use a hard coded value instead of the Project property the same JSON path is working fine and assigning the result to the target property. 

 

 

Can anyone please let  me know how to make it work?

 

Thanks

Vijay

 

2 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    You don't need the quotes around the property expansion:

    $..books[?(@.book.name==${#Project#bookName})].author[0]

    A JSONPath expression is a code expression, so '${#Project#bookName}' in quotes is treated as a literal string, whereas without quotes it works as a property expansion.

     

    This should work in the maintenance build:

    https://support.smartbear.com/downloads/readyapi/nightly-builds/

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

     

    Hi Vijay,

     

     

    Could you please clarify a bit where you use this code? Please share several images of your screen to help us better understand the issue.

     

    BTW, are you using the latest Ready! API version - v. 1.9? If you aren't, I suggest that you update to this version and check if the behavior has changed.