Validation - Comparing Two Output Files

Ranorex Spy, Recorder, and Studio.
jeffs
Posts: 5
Joined: Wed May 05, 2010 9:53 pm

Validation - Comparing Two Output Files

Post by jeffs » Wed May 05, 2010 11:25 pm

I looked in the help, and did not see anything regarding file comparison for validation. Is this available in Ranorex, and if so, how to end a recorded test with a validation that compares two files?

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

Re: Validation - Comparing Two Output Files

Post by Support Team » Thu May 06, 2010 9:09 am

Hi!

Out of the box we have no file comparison method. But Ranorex provides you the whole Framework functionality of .Net, so you are able to code your own methods/classes and functions.
Please take a look on following article http://support.microsoft.com/?scid=kb%3 ... 8&x=19&y=9
This is a step by step tutorial how to create your own file comparison function.
To use this method in a Ranorex Recording, just add a User Code item to your Recording and add a Validation like:
Validate.AreEqual(YourClass.FileCompare("File1.txt","File2.txt"),true,"File comparison",true);
Regards,
Peter
Ranorex Support Team
.
Image

jeffs
Posts: 5
Joined: Wed May 05, 2010 9:53 pm

Re: Validation - Comparing Two Output Files

Post by jeffs » Fri May 07, 2010 1:26 am

Thanks. That worked out very well. I didn't realize that you can create C# classes and call them from within the testing script. Very nice.

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

Re: Validation - Comparing Two Output Files

Post by Support Team » Fri May 07, 2010 8:30 am

jeffs wrote:I didn't realize that you can create C# classes and call them from within the testing script.
That's because actually the so-called testing "script" is pure C# code. Ranorex is a .NET library and all of your test "scripts" are .NET assemblies as well, consequently, you can use all of the features of the .NET Framework inside your testing code.

Regards,
Alex
Ranorex Support Team
.
Image