Forum Discussion

legeti's avatar
legeti
New Contributor
12 years ago

Check if Reponse equals result of an formula

Hi all,

I have a little problem.....

I want to check if a specific field in the response equals to an formula.

For example:

<response>
<result>150</result>
</response>


I have the following custom properties or request parameter.
${testcaseA#A} = 50
${testcaseB#A} = 50

Then i want to add an assertion which check if <result> == ( ${testcaseA#A} * 2 ) + ${testcaseB#A} = 50

How can i do such kind of calculation for assertion?

Thank you in advance!
BYE
legeti

1 Reply

  • SiKing's avatar
    SiKing
    Community Expert
    Use XPath assertion. The XPath expression will be just a simple
    //*:result
    and the expected result will be a Groovy formula
    ${=${testcaseA#A} * 2 + ${testcaseB#A}}


    Note that from your properties naming, it looks like you have the properties in two different test cases. It is not possible for one test case to see the properties of another. You will need to move the properties up to at least the test suite level.