Let’s test Ubuntu NOW!

Making Ubuntu better, if possible

Dealing with UTF-8 characters

with one comment

To create our automated tests for the Desktop at Ubuntu we are using LDTP (Linux Desktop Testing Project), a framework that relies on the Accesibility layer to manipulate the desktop objects.

LDTP comes with a python wrapper to be able to create tests in python. One of the tests that we wrote was Gedit Chains that tries to open Gedit, writes a string chain, saves it, and compares the resulting file with an already saved oracle file.

We have two test cases for this test. The first one wrote an ASCII string, “This is a very basic string”, and it was successfully run against Intrepid Alpha3. The second one tried to write a string with Japanese characters, to test UTF-8 with Gedit. This test failed. The problem root was that python-ldtp communicates with LDTP server with XML, and the necessary encoding was not being done properly. Therefore, each time I tried to run this test I got the following error:

settextvalue _message = generatexml (command.SETTEXTVALUE, _requestId,
windowName, componentName, text) File
"/var/lib/python-support/python2.5/ldtp.py", line 84, in generatexml
_argDebug += ", " + str (args [index]) UnicodeEncodeError: 'ascii' codec
can't encode characters in position 27-30: ordinal not in range(128 )

I posted the error on the LDTP mailing list and 24 hours later Nagappan, one of the main LDTP developers, checked the patch into their GIT repository (Thanks!!). I tried again my script with the LDTP GIT version and this time it run smoothly.

I think it is a very important fix, as UTF-8 characters are likely to give errors in text editors, terminals or browsers. I have created PPA packages for Intrepid that include this fix so that anyone can try this test. Intrepid packages are available at https://launchpad.net/~apulido/+archive.

Written by Ara Pulido

August 1, 2008 at 10:55 am

Posted in Uncategorized

One Response

Subscribe to comments with RSS.

  1. Nice work! Nags is always ready to help..

    Kartik Mistry

    August 4, 2008 at 6:19 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: