WS.verifyElementPropertyValue decimal value compare

i got confused about verifying decimal value with WS.verifyElementPropertyValue
api response value like 5.0, expect value is 5.00
i think is same. but WS.verifyElementPropertyValue(response, 5.0, 5.00), this will fail.
any advice for this comparison?

You will have to decide how important is an exact comparison.

  1. truncate both values to just the Integer part, i.e. 5
WS.verifyElementPropertyValue(response, (Integer.parseInt(5.0)).toString(), (Integer.parseInt(5.00)).toString())
  1. take the left-most 3 characters, i.e. 5.0
WS.verifyElementPropertyValue(response, (5.0).toString().substring(0,3), (5.00).toString().substring(0,3))
  1. concatenate additional zeros onto both, then truncate to same string length.
myNumber = StringUtils.left(myNumber.toString() + '0000', 5)

or

myNumber = (myNumber.toString() + '0000').substring(0,4)
1 Like