I start off by extracting the 'amount' from the json response. (This is the originalBalance) After performing another action I then extract the 'amount' from another json response. (This is the newBalance).
I am then doing a match to check that the newBalance equals the originalBalance minus (from Examples) as shown here:
* def originalBalance = $response.giftCards[0].balanceAmount.amount
* def newBalance = $response.giftCards[0].balanceAmount.amount
And match newBalance == originalBalance - <amountToDeduct>
Examples:
| amountToDeduct|
| 0.01 |
Most times I run this it works fine. But other times it fails with a message similar to this:
match failed: EQUALS $ | not equal (NUMBER:NUMBER) 124.95 124.94999999999999
The two values that are being extracted from the json response are ok so there must be something going wrong with this line:
And match newBalance == originalBalance - <amountToDeduct>
Any idea what I am doing wrong?