Let’s test Ubuntu NOW!

Making Ubuntu better, if possible

Getting information from labels

leave a comment »

In the previous post we talked about the difficulties when trying to recognize widgets through its accessibility information. If normally is a pain, it can certainly be worse when dealing with labels.

Labels text does not only change their text when the language is changed, but they can change their text in different states of the application work flow. Let’s imagine that an application uses the same label to show error messages to the user (very common scenario). If the label does not have correctly set its ‘name’ in the accessibility information (very very common scenario), then the name of the label will be the current text of the label, and our test script won’t be able to gather errors or any other information from these labels.

If the text of the label has some kind of structure, though, some of this information can be retrieved, using regular expressions to search for common patterns, for example, if error messages always start with the text ‘Error:’ we could get the rest of the text of the label to obtain the error message.

For Ubuntu we are using some of these “pattern” labels to get some useful information from the applications. In the update-manager a label with the pattern “You can install n updates.”, is shown every time at least one update is available, where n is the number of available updates. The method number_udpates, part of the Ubuntu testing library, scans the available labels for that pattern and returns the number of available updates. Anyone wanting to write a test for update-manager can use this and any other available method in his or her test script.

Written by Ara Pulido

August 12, 2008 at 2:25 pm

Posted in Uncategorized

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: