Efficient table sorting validation?

Class library usage, coding and language questions.
kmck
Certified Professional
Certified Professional
Posts: 83
Joined: Fri Jul 12, 2013 2:41 pm

Efficient table sorting validation?

Post by kmck » Thu Apr 10, 2014 2:35 am

When validating table sorting with Ranorex (specifically individual column sorting in a table) I've noticed it's difficult given the type of sorting performed by C#. For instance, sorting alphanumeric strings or strings with special characters requires the use of a custom IComparer (for natural or unicode sorting) to accurately sort each column the way a table will sort the column in ascending or descending order.

My process is to gather each column data into separate lists as strings or datetime objects, sorting the list<string> or list<datetime>, then validating the sorted data against what is actually listed in the table after sorting the table. However, problems arise due to the way sorting is done in C# and how sorting is done in directly in a table, causing the two datasets to not match.

Has anyone found an elegant and effective way to validate a table's data sorting with Ranorex?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Efficient table sorting validation?

Post by krstcs » Thu Apr 10, 2014 1:50 pm

First, what language is your SUT written in? If it is .NET, ask your developers what IComparer interface they used. If it is in the base .NET libraries, you can use it as well.

Second, if it isn't .NET (or if this is easier...), is there a database that is doing the actual sorting and the result set is being presented to the UI for display? If so, just get read access to the DB and look up the actual values at runtime. Your probably not testing the DB itself, so you can assume that it presents the data accurately, all you need to do is verify that the SUT presents it accurately as well. This is what I do. Our SUT uses Oracle, but I have a link to it from my test DB (SQL Server Express) so I can look up anything I need to validate.


In other words, try not to re-invent the wheel, unless absolutely necessary. :D
Shortcuts usually aren't...

kmck
Certified Professional
Certified Professional
Posts: 83
Joined: Fri Jul 12, 2013 2:41 pm

Re: Efficient table sorting validation?

Post by kmck » Wed Apr 16, 2014 2:26 pm

Hi krstcs,

Thanks again (as always!) for your help! We are working on a .NET application, but rather than utilizing an IComparer our team relies on the DevExpress Grid Control sorting. I have access to the database, and am now pulling data from the database and match it directly to the table data, as noted, which worked successfully for the most part. It took a little tweaking, but overall that does seem to be the most efficient and elegant method for validating the table sorting. :D