Page 1 of 1

Validations not throwing a validation exception

Posted: Thu Jul 18, 2013 4:54 pm
by jjorgens
The validation class is not throwing a validation exception when the validation fails.

Example:
This is an example when the validation is expected to succeed. This is working how I would expect it.
PS C:\Users\jared>

Code: Select all

 [Ranorex.Validate]::AreEqual(1,1) 

[2013/07/18 09:19:00.346][Success][Validation]: Objects are equal (actual='1', expected='1').

This is an example when I force it to fail:
PS C:\Users\jared>

Code: Select all

 [Ranorex.Validate]::AreEqual(2,1)

[2013/07/18 09:19:04.086][Failure][Validation]: Objects are not equal (actual='2', expected='1').
Exception calling "AreEqual" with "2" argument(s): "Objects are not equal (actual='2', expected='1')."
At line:1 char:29
+ [Ranorex.Validate]::AreEqual <<<< (2,1)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException



I am running these examples from powershell which is why I am using the syntax [Ranorex.Validate]::AreEqual(). Why is this throwing a MethodInvocationException rather than a validation exception? I am using this simple example with comparing two numbers but it behaves this way on any validation I do with actual elements.

System Info:
[2013/07/18 09:25:58.773][Info ][SystemSummary]: Host: computer.test
Ranorex version: 4.0.3.22982
OS version: Windows 7 Service Pack 1 64bit
OS default locale: en-US
.NET Runtime version: 4.0.30319.18052
Number of logical CPUs: 4
Number of displays: 2
Screen dimension: 3840x1200
Memory: 60% load, phy 3219mb free/8181mb total, virt 1732mb free/2047mb total.

Thanks,
Jared

Re: Validations not throwing a validation exception

Posted: Fri Jul 19, 2013 3:02 pm
by Support Team
Hello,

Do you get the same exception if you run the <TestSuite>.exe using command line?
In general, we throw a validation failure message if validation fails:
[2013/07/18 09:19:04.086][Failure][Validation]: Objects are not equal (actual='2', expected='1').
Exception calling "AreEqual" with "2" argument(s): "Objects are not equal (actual='2', expected='1')."
It looks like that the other exceptions are thrown if you use PowerShell.

Regards,
Markus (T)

Re: Validations not throwing a validation exception

Posted: Wed Jul 24, 2013 7:14 pm
by jjorgens
My test suite is not an .exe, it is a ps1 powershell script. I am not sure what you mean, do you want me to create an .exe test suite and run it from cmd.exe?
All the other Ranorex functions I run work perfectly in powershell just not this validation.

Re: Validations not throwing a validation exception

Posted: Thu Jul 25, 2013 3:52 pm
by Support Team
Hello,

In general, a solution in Ranorex Studio or Visual Studio creates a binary file (*.exe) of a Test Suite after compiling. This file will be used to run a test using command line (cmd.exe).
If you create a validation, the report should only show the message attached.
Other exceptions seem to be related with Power Shell only.

Regards,
Markus (T)