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

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

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

1 Like

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
https://docs.katalon.com/katalon-studio/docs/common-verify-match.html#example-

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

they don’t match. You could use this:
https://docs.katalon.com/katalon-studio/docs/webui-verify-text-present.html#example

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.

2 Likes

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

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

1 Like

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

1 Like