FeatureRequest: Extension to Validate.AreEqual

Ask general questions here.
UgaAga
Posts: 69
Joined: Thu Mar 15, 2012 2:11 pm

FeatureRequest: Extension to Validate.AreEqual

Post by UgaAga » Fri Oct 25, 2013 10:49 am

Hi,
the Ranorex.Validate class is very useful. A nice extension to this class would be a comparison of two double values with a specified delta and a comparison of two lists of string:

Boolean AreEqual(Double actual, Double expected, Double delta)
Boolean AreEqual(List<String> actual, List<String> expected, bool ignoreCase)

What do you think?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: FeatureRequest: Extension to Validate.AreEqual

Post by Support Team » Tue Oct 29, 2013 5:10 pm

Hi,

Do you have a use case for such a feature?

You just receive strings from the applications, the values of the attributes are saved as strings and the module variables too, so how respectively where do you get such double values from?

Regards,
Markus
.
Image

UgaAga
Posts: 69
Joined: Thu Mar 15, 2012 2:11 pm

Re: FeatureRequest: Extension to Validate.AreEqual

Post by UgaAga » Fri Nov 01, 2013 3:50 pm

Hi,
in my test cases i often convert the strings from the application and the variables from the data sources to doubles and test them for equality. I wrote my own method, but it would be nice to have the ranorex validation behavior too.

Regards

My method (it's not perfect, especially with values near infinity)

Code: Select all

        public static Boolean EqualsRelatively(this Double instance, Double obj, Double tolerance)
        {
            if (instance == obj)
            {
                return true;
            }
            else
            {
                Double delta = Math.Max(Math.Abs(instance), Math.Abs(obj)) * Math.Abs(tolerance);
                if (Math.Abs(instance - obj) > delta)
                {
                    return false;
                }
            }
            
            return true;
        }

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: FeatureRequest: Extension to Validate.AreEqual

Post by Support Team » Mon Nov 04, 2013 11:40 am

Hi,
UgaAga wrote:I wrote my own method, but it would be nice to have the ranorex validation behavior too.
I've added an issue to our internal feature list. Maybe this feature will be available in one of the next Ranorex versions. If we add such a feature you can find it in the release notes of the version.

Regards,
Peter
Ranorex Team
.
Image

UgaAga
Posts: 69
Joined: Thu Mar 15, 2012 2:11 pm

Re: FeatureRequest: Extension to Validate.AreEqual

Post by UgaAga » Mon Nov 04, 2013 1:45 pm

Thanks!