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?
FeatureRequest: Extension to Validate.AreEqual
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: FeatureRequest: Extension to Validate.AreEqual
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
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
Re: FeatureRequest: Extension to Validate.AreEqual
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)
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;
}
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: FeatureRequest: Extension to Validate.AreEqual
Hi,
Regards,
Peter
Ranorex Team
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.UgaAga wrote:I wrote my own method, but it would be nice to have the ranorex validation behavior too.
Regards,
Peter
Ranorex Team