Forum Discussion

gordillo_ramon's avatar
gordillo_ramon
Contributor
13 years ago
Solved

REST Property Expansion

Hi all.

I have tried to use the property expansion in a POST REST request, in the body part, but every time I get the property unexpanded, just the literal "${..."

I get the same property expanded in the headers. Is it possible to use it in the body?

TIA.

Ramon
  • Normally a JsonPath expression must start with the '$' operator, except assertions seem to be processed in a slightly different way.  Does this expression work?

     

    ${TestStepName#Response#$..id[1]}  

5 Replies

  • balak84's avatar
    balak84
    Occasional Contributor
    Hi,

    Data can be read from the properties on to the Rest Test Request's body.

    Example:

    "Age": "${#Project#User-Age}"

    Here,

    On the Rest Test request, the field Age is allocated the value held by the << User-Age >> variable of the Custom Properties of the Project. (Similarly, the value can retrieved from Test Case/Test Request properties as well)

    Assuming,

    << User-Age >> variable of the Custom Properties of the Project holds the value 23,

    Then the result post the execution will be,

    "Age": "23"

    This can be seen in the Raw tab post the completion of the run of the test step.

    Regards.
  • Hi.

    I know how to set up the property expansion. If you read my post, I got it done in the header parameters.

    Anyway, I have upgraded to 4.5, and the issue is fixed.

    Regards
  • I am currently using Soap UI v5.3, and am also having this issue.  I am unable to locate a solution to this issue of TestStep property expansion failing when used in the POST body.  Can anyone suggest how to correct?

     

    Ex:  ${TestStepName#Response#.id[1]}  

     

    This returns blank when used in the POST body of the REST call (as seen when viewing the Raw tab), but returns a valid value if used either in the Header or an Assertion.  Please advise.  

     

    Thanks in advance.

    • PaulMS's avatar
      PaulMS
      Super Contributor

      Normally a JsonPath expression must start with the '$' operator, except assertions seem to be processed in a slightly different way.  Does this expression work?

       

      ${TestStepName#Response#$..id[1]}  

      • popea18's avatar
        popea18
        New Member

        Excellent!  That was the problem.  Thank you for your time!