Monday, July 18, 2011

Fun with Squish and Python

At my current gig, we are using Squish to test a new QT-based GUI app. It's been a hoot. Squish is frameworks, eclipse, and python. Oh, yes, squishy yummy python.

To start with, we used the QT interface to start measuring and checking UI widgets. There are some very exacting standards on color, placement, and size of visual elements and squish is helping get the specs converted to a runnable form. This was my original goal for the tool.

The team was recording tests post-facto, so I jumped in and we build up some libraries and syntax sugar so that it's easy to build the tests before the code. Hopefully we'll see a lot less code being returned over minutae now that programmers can run the specifications while they're building the code.

The next step was to automate to the simulators that sit under the app. This was delivered last week, and we added some more sweet syntactic sugar to make it easy to script simulators in the gui tests. It's still not lightning-fast, but it does the job. There was quite the buzz about it, as it enables the company to do a lot of end-to-end testing and demonstration.

Squish is an interesting environment, and they did a few things I didn't care for like adding an 'object' module which hides the built-in type. I've learned to work around some of the gotchas so those don't bother me too much. It was just an interesting learning experience.

What I love is that the environment allows me (a developer) to provide rather powerful support to the testers on the team, and allows them to do quite a bit of programming in a way that it resembles simple data tables and English. Those who've stopped by for the demos have remarked that the tests read clearly enough that they can understand and critique them.

Our next trick will be using Squish and PIL to test some aspects of UI rendering that are not really feasible in native Squish and QT. This has been a fun trip so far, and we'll see where it takes us next.

I have mixed thoughts about gui testing. It is slow and requires you to stand up a complete image (with all that mean in setup and teardown). It scales better than manual testing, but can have a certain brittleness that manual testing to textual scripts does not. Even so, Squish does a good job and covers our platforms, so I think I'll stay with it.