Custom Validation

Ask general questions here.
ant_katcin
Posts: 8
Joined: Thu Jun 14, 2012 2:52 pm

Custom Validation

Post by ant_katcin » Thu Jun 14, 2012 3:22 pm

Hello.

My project require a custom validation of data saved to database by application.

I developed a little validation class that looks like this:

Code: Select all

public class DataChecker
{
  public static void CheckSessionStarted(string resourceName) { ... }
  public static void CheckSessionClosed(string resourceName) { ... }
  ...
}
There are should be a really LOT of validations and i have a trouble how to organize that in Ranorex Studio. One of possible ways is use User Code, but there is impossible just to write DataChecker.CheckSessionStarted("SomeResource"); because i need to specify just a method. So i have to duplicate DataChecker interface in each Recording and call DataChecker from methods. A lot of useless code, that makes me sad.

Ideally i want a ability to add custom action that can add some parameterized code snippet to generated result code. So in this way creating tests won't require any programming.

Is it possible? Or better solution is forgot about Recoder and write own code?

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

Re: Custom Validation

Post by Support Team » Fri Jun 15, 2012 1:24 pm

Hello,
but there is impossible just to write DataChecker.CheckSessionStarted("SomeResource"); because i need to specify just a method
That's not necessarily true, you can also call the method in the "Init()" method of the "YourRecording.UserCode" partial class.
There is also the possibility of using variables in the recording to validate data specific values, I would suggest taking a look at the specific section about Data-Driven Testing.
At the moment it is unfortunately not possible to directly call a method from another custom class, you just can add a UserCode Action which calls the specific method, but you of course can add parameters and also variables as parameters to your UserCode actions, therefore please take a look at: User Code Actions.
I hope this points you in the right direction.

Regards,
Markus
Ranorex Support Team
.
Image