Forum Discussion

Sriraj's avatar
Sriraj
Contributor
7 years ago

Property expansion in "JSON path match assertion"

Hi,

 

I have a property which needs to be used as part of a JSON path in the assertion. However when i add it the property expansion does not evaluate .

 

Some thing like below in JSON Path Match Assertion : 

 

Path : 

$[0]['Items__r']['records'][?(@.Id__c=='${Source_OrderNumbers#Points}_1')].Status_Id__c

 

Expected value :

 

[Placed].

 

path ${Source_OrderNumbers#Points} does not evaluate in assertion to a value which was populated 2 steps before .

3 Replies

  • LexiAQA's avatar
    LexiAQA
    SmartBear Alumni (Retired)

    Hi,

     

    What kind of property are you referring to? How exactly this property is set? I've just tested the product behavior, and a test case property can be used just fine in the JSONPath Match assertion.

    • Sriraj's avatar
      Sriraj
      Contributor

      i have attached as screenshot what i am trying to do.

       

      the property in bold in the below is generated 1 step before the step in which this assertion is applied.

       

      $[0]['Items__r']['records'][?(@._Item_Id__c=='${DataSource_CreateOrderNumbers#Points}_1']['Order_Status_Id__c']

      • PaulMS's avatar
        PaulMS
        Super Contributor

        Can you temporarily replace ${DataSource_CreateOrderNumbers#Points} with the expected property value to confirm that the assertion passes successfully without property expansion?

         

        What is the error message if the assertion fails?