Ask a Question

Regarding rounding function

Occasional Contributor

Regarding rounding function

I would like to add rounding function in my assertions

[Match content of [xyz]] Comparison failed. Path: [$['xyz']]; Expected value: [5.461*]; Actual value: [5.46076854].

Expected value: [5.461*] is in ExcelQATestfile (Excel file cannot be modified)
Actual value: [5.46076854]  is API output 

So, I am looking for a solution that will make my readyapi assertion force Actal value  to rounding and I get Expected  = Actual

Please help me..

Champion Level 0

Do you know if the amount of significant digits required will always be the same? IE, in the example you gave, the Excel spreadsheet shows 3 significant digits and *.  If they'll always be the same this may be easy to handle.


What type of assertion are you using? That'll define a way forward. In my experience, I am not sure an XPATH statement can handle this, but a custom groovy script possibly could.


Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
Showing results for 
Search instead for 
Did you mean: