Forum Discussion

anagai's avatar
anagai
Occasional Contributor
5 years ago

Using property expansion in header param does not work

I have set a custom property 'token' at the project level and would like to use that value in a header param.

 

I am putting this into a header param value field:

 

${#projectname#token}

 

It is not grabbing that custom property value I set at the project level. Doing something wrong?

  • Hi anagai,

    Search for "soapui property expansion" and pick the first link returned. This explains that youre adding an extra hash # character erroneously.

    The syntax required is as follows:

    If you use '${#Project#propertyname}' so the value that goes between the two # values is the 'scope' or level of where the property is stored. So 'scope' would be 'Project' or 'TestSuite' or 'TestCase' etc., NOT 'Projectname' nor 'TestSuitename' nor 'TestCasename'.

    Whereas if you are specifying the name of project rather than just indicating the scope, you only use a single # character.

    E.g. ${Projectname#propertyname}

    Cheers,

    Rich
  • richie's avatar
    richie
    Community Hero
    Hi anagai,

    Search for "soapui property expansion" and pick the first link returned. This explains that youre adding an extra hash # character erroneously.

    The syntax required is as follows:

    If you use '${#Project#propertyname}' so the value that goes between the two # values is the 'scope' or level of where the property is stored. So 'scope' would be 'Project' or 'TestSuite' or 'TestCase' etc., NOT 'Projectname' nor 'TestSuitename' nor 'TestCasename'.

    Whereas if you are specifying the name of project rather than just indicating the scope, you only use a single # character.

    E.g. ${Projectname#propertyname}

    Cheers,

    Rich
    • anagai's avatar
      anagai
      Occasional Contributor

      I didn't find that doc when searching google. All the other sites say ${#Project#Name}  . I thought Project was project name. Looks like a placeholder to me.

      • anagai's avatar
        anagai
        Occasional Contributor

        I actually need ${#TestSuite#Name} - I want to place my custom property in the containing test suite. Thanks for pointing me in the right direction.