Ask a Question

Process two different property values and set the results in another test case property

SOLVED
mpw83
Contributor

Process two different property values and set the results in another test case property

I have two test case level properties,  'Amount' and 'Interest' 

I want to add the values of these two properties and set the answer to another property called 'Payment' 

${#TestCase#Amount} ->  20000

${#TestCase#Interest} -> 200

${#TestCase#Payment} ->  20200

 

To do this I know I can use a groovy script but is it possible to directly do the calculation inside of the property?

like ..  ${#TestCase#Payment}  -> ${#TestCase#Amount} + ${#TestCase#Interest}  
If I call this property  ${#TestCase#Payment} inside in an assertion as the expected results, then It just compares with '20000 + 200' not the answer (20200).
Also, can we do this kind of calculations directly inside the assertion? 

 

2 REPLIES 2
jsheph01
Contributor

You can use the script below as the property value for payment. You should be able to use that for an assertion as well, it just depends on what type of assertion you are doing.

 

${=import java.lang.Integer;def Payment = ${#TestCase#Amount} + ${#TestCase#Interest} }

 

@jsheph01 , Thanks , works for me

cancel
Showing results for 
Search instead for 
Did you mean: