SilkTest Automation

Sort Order

12:59, 2008-Jan-15 .. 0 comments .. 0 trackbacks .. Link

As I may have mentioned before, our software is available in English, German, Spanish, and French. I need to write my tests so they run in all supported languages, and along the way need to test the actual text strings themselves. Part of that testing involves sort order.

Many of the things we display in lists have a list header that can be used to sort the list on different columns. Many of my test cases have me validate that clicking on any particular list column header will indeed sort by that column, and sort correctly.

So, what exactly is a "correct" sort? It seems the correct answer is "it depends". The next question is, "How can I determine if a list is sorted correctly?"

According to the SilkTest help file, there are only two sorts available in SilkTest - ArraySort and ListSort. As you might imagine, they sort arrays and lists. Since I'm testing the sort order of lists, it makes sense to use the ListSort. The sort is said to be a "dictionary sort", which I would expect in this case, but makes no mention of exactly what the dictionary is nor whether it can be changed. It does mention this sort uses the Windows "locale" setting.

The actual code to determine if a list is sorted is pretty easy - I take the original list (from the GetContents(iColumn) method), make a copy of it, sort the copy, then compare the two. If they are identical, then the list is sorted. However, this only sort-of works.

First problem - upper versus lower case. An "a" doesn't sort near an "A", but rather all lower-case alphas sort after the upper-case alphas. Yet, in a phone book or dictionary sort, case is irrelevant. Sadly, SilkTest makes no provision for setting the case sensitivity. I work around this issue by upper-casing the list items before I make the sort copy. And I should stress it is a workaround, not a fix.

Next comes the issue of special characters...where should they sort? I'm only concerned with the special characters available from the keyboard, such as the shift-number keys. Unfortunately, it appears these characters sort in odd ways - some are before the numeric (0-9) characters, some between the numeric and the alphas, and some after the alphas. In my mind, it seems they should all sort before the numerics, or after the alphas.

Finally, there's the problem of accented characters. For instance, Spanish has the Ñ character, while French has accented vowels and German has vowels with umlauts as well as the ß character. Where should they sort?

In an ideal world, they should sort next to the matching unaccented character (or N or S for the other two), but only in the language that uses them. For instance, the Ñ should sort after the N in Spanish, but after all the alphas in English, French, and German (since it's not part of their language character set).

I'm still working on this, and will probably need to create my own custom sort routine, where I can apply a different dictionary for each language. Both our application, and SilkTest, claim to sort based on the Windows locale settings, but as near as I can tell, neither one does.

I'll have further details if and when I solve this one.

 


Trackback

{ Last Page } { Page 3 of 4 } { Next Page }

About Me

Home
My Profile
Archives
Friends
My Photo Album

Links


Categories

Localization
Obscure Stuff
Configuration Management

Recent Entries

Finding Maximum Text Field Size
Builds - How Often?
Sort Order
Localization Testing

Friends