Forum Discussion

WaveyDavey's avatar
WaveyDavey
Occasional Contributor
13 years ago

Property Expansion in Assertion

We deal with phone numbers.
I have a value is a properties test step, called currentRange, value '0844'. It has to be that form, as its required that way in the URL REST step.
I then make a diagnostic call to the API to check previous call went well. The xml returned is similar to:

<root>
<error>200</error>
<errorText>OK</errorText>
<data>
<id>123456</id>
<core_range>844</core_range>
<core_number>1234567</core_number>
<destination>07123123123</destination>
<mapper>foo</mapper>...

So compare XPath Expression //root[1]/data[1]/core_range[1]/text()
with ${Properties#currentRange},

I want to fix the assertion that core_range xpath item (844) is same as (0844), which it isn't, in this form. It seems like property expansion, ${=... is where I should be looking, to coerce the string 0800 to int, or something, but I can't seem to get it right. Any ideas ?

David

2 Replies

  • WaveyDavey's avatar
    WaveyDavey
    Occasional Contributor
    Think I got it:
    ${=Integer.parseInt(context.expand( '${Properties#currentRange}' ))}

    Need to learn Java, I guess. And groovy. Sigh