So I already have code working to validate an int but the problem is that the number is going to be slightly different than what is entered everytime. When I validate I need to validate the value within a range not the exact value. For example when I enter a value of 15750 I may receive it as 15759 on the validation side. This is due to various rounding methods that happen in our system and is correct so I don't want this to show up as a failure in my tests. I would like to validate that the altitude equals 15750 plus or minus 25. So basically if 15750 was entered everything from 15725 to 15775 would pass the test.
Can anyone help me out please?
How to validate number is within range of a number
- Gunner1980
- Posts: 89
- Joined: Mon Apr 05, 2010 8:44 pm
- Location: Austin, Texas
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to validate number is within range of a number
Hi,
Peter
Ranorex Support Team
Use the Validate.IsTrue() method to check if the value is inside your range.Gunner1980 wrote:I would like to validate that the altitude equals 15750 plus or minus 25. So basically if 15750 was entered everything from 15725 to 15775 would pass the test.
Validate.IsTrue( (value > x - 25) && (value < x + 25) );Regards,
Peter
Ranorex Support Team
- Gunner1980
- Posts: 89
- Joined: Mon Apr 05, 2010 8:44 pm
- Location: Austin, Texas
Re: How to validate number is within range of a number
Thanks that worked like a champ!