monotonous.org

Let's all do it right the first time

For the last month or so I have been plugging away and thinking of efficient and approachable ways for testing WAI-ARIA conformance across browsers. When Firefox first implemented ARIA there was plenty of hard work being done both by the Firefox developers and the assistive technology developers to assure that users will have a smooth experience when they encounter rich internet applications using Firefox. The accessible web experience is fortunately spreading with Webkit, Opera and IE working on their own ARIA implementations. What we really needed was an accessibility “acid test” to assure that these discrete implementations share enough in common so that screen readers and the likes will support all browsers with minimal blood sweat and tears.
I reached a couple of dead ends. Nonetheless I hope that most of that code has not been written in vain. For example, I have a Python library that does accessible tree comparisons using an algorithm that produces a minimal delta description. This makes it easy to quickly spot differences in large and complex accessible node trees.
Anyway, I happened upon an awesome project called Selenium that provides automated cross-browser, cross-platform web testing. This was a good find. Besides being browser and platform agnostic, Selenium is also fairly language and test framework agnostic, allowing tests to be written comfortably and integrated into any kind of test framework and scripting language.
Besides the Selenium “remote control” that runs on test target machines, I created another service called Specular, or Speclenium (the serializer and core is Specular, the specific service that works with Selenium is Speclenium). This server communicates with the remote control via XML-RPC and relays accessibility related assertions and verifications. This allows Speclenium to “do one thing well” and deal exclusively with accessibility related tests. Since Specular/Speclenium is written in Python, I was able to take advantage of both pyatspi and pyia to provide cross-platformness (Win32 and Unix). This allows writing tests that will work on both platforms.

[Diagram of Selenium and Speclenium topology](/assets/uploads/2008/08/spec-dia.png)
Diagram of Selenium and Speclenium topology

This is what you need to get it up and running:

Note to non-git users: You don’t need to download and learn git. Github provides download links with current snapshots of the files in the repo.
Setup steps:

  1. Set up the target machine:
    1. Run selenium-server on the machine with the test environment.
    2. On the same machine run ‘speclenium’, it’s a Python executable in the specular package.
  2. On another machine (or the same one), set up the speclenium test scripts.
    1. Customize tests/settings.py in the specular package. It should point to your target machines and to the available browsers. It’s pretty self explanatory.
    2. I provided some sample tests that could be run with the run_tests Python executable. Try “run_tests -h” to get an idea of how to run them.

I’ll provide a screencast in the future for the lazy folks. In any case, I hope to polish up all the steps above and make setup a pleasant and simple experience. This is important especially in Windows where prerequisites could be a pain the the behind.
Oh yeah, the other use case for this hairball is accessible web application development. If you are a l33t web developer, and you test your code with Selenium, you should use Speclenium too!
That’s a long post. I hope to make all of that less complicated and streamlined in the near future.