How to verify the contains value of two variable have values 150.00 and 150


#1

Hi,

I have scenario for verifying the values of two variables.
One variable which contains 150.00
and Second Global variable which contains 150
Both are equal but when I am using Verify Match Keyword then its getting failed.
What should I do!I want to check the contains value.

Thanks,
Sristi Sharma


#2

asuming the global variable is numeric, convert the other one to int.


#3

To further explain on @Ibus 's point. Numbers are just not numbers and 150 compared to 150.00 will fail. You need the same type, be it int, float, double, or decimal.

Verify match

will look to compare strings. and comparing
150 == 150.00
is like comparing:
Cat == Cat.tt

they don’t match. You could use this:

verify part of it is present, but I would recommend looking for a direct match and like Ibus said convert the one you know is in the format you want.


#4

@sristisharma90 You can search for “BigDecimal” in the forum. There are some topics covering the scenario you shared.


#5

or … convert both of them to string and split by dot, select first field :)))


#6

or, convert the global to float or bigdecimal with two decimals. if the other one is string, convert it too