Forum Discussion

mcresswell's avatar
mcresswell
New Contributor
12 years ago

[Resolved] $ Next To Property

I am using the contains assertion to check for "$10" is in the soap response. 10 is a property that can change, so the contains assertion is actually "$${#TestCase#Amount}". This property is not resolving to 10 as expected.
-->Missing token [${#TestCase#Amount}] in Response

An escape character, "\$${#TestCase#Amount}", did not help either.

If I add a space after the dollar sign, "$ ${#TestCase#Amount}", the property resolves as expected
-->Missing token [$ 10] in Response (since there is no space in the fault message)

Has anyone successfully had a $ immediately before a property and still had it resolve correctly?
  • Interesting! This is a corner case that we hadn't thought of. I'll discuss introducing escape characters for property expansion with the other developers.

    Meanwhile, you can use dynamic properties as a workaround (they are described on this page: http://www.soapui.org/Scripting-Propert ... nsion.html)

    I think this should work in your case: "${= '$' + context.getProperty('test')}".

    Kind regards,
    Manne
  • mcresswell's avatar
    mcresswell
    New Contributor
    Woah! Dynamic properties look awesome, they look like they could be handy elsewhere in our projects too. They were a suitable workaround.

    Just to help anyone who comes across this later, I had to use "${= '$' + context.getPropertyValue('test')}" to get the actual value of the property.