One of the problems with using HTML as the user interface is testing it (in fact testing user interfaces has always been a bit of a problem) so I’m always on the look out for good UI testing tools.
For a while I’ve known about and used Watir which scripts Internet Explorer (and now Firefox with FireWatir though it’s a bit more tricky to set up). Watir allows you to write simple but powerful scripts in Ruby that will instruct IE to load up a page, fill in a form, click a button or whatever and then you can make assertions about what should have happened. It’s not difficult to use and even if you don’t know Ruby, if you know other languages, you can soon pick it up.
The thing I’m currently looking for though is a test environment where I don’t have to install a large infrastructure and which works easily on both PCs and Macs, supporting both IE and Firefox. Selenium seems to give me exactly that. In fact the project’s customer could probably install it on their PC and be able to run the tests (or even record new tests) which would be great.
Please let me know if you know of other tools that would fit the bill or what your experience is with these tools.
This is a little tip that I discovered a while ago but which I’m always forgetting, so I thought I’d post it here where I woudn’t lose it! Sometimes you’ll have a link on a web page which actually does something to a database, deletes the current thing for example. In those circumstances you want to have some sort of “Are you sure?” confirmation.
Click here to go to home page
And of course you can try it yourself: Click here to go to home page.
If you click OK, then the confirm returns true and the link is followed. If you click Cancel, then confirm returns false and the event isn’t bubbled up to the href handler and so the link isn’t followed and you stay on the same page.
A friend recently pointed me to a useful development toolbar for Firefox. It’s similar to the development toolbar here but does even more stuff.
You can find the toolbar at http://chrispederick.com/work/webdeveloper/.
Just a quick tip about xsl which I haven’t found anywhere else…
I wanted to generate some human (well me) readable XML using XSL and found that if you add xml:space=”preserve” to the opening tag, then, at least if you are using Xalan and Java to do the transformation, it will preserve the spaces between the tags in the XSL and you’ll get something more or less readable. Continue reading xml:space=”preserve” and xsl:attribute
I’ve recently been trying to make some of my scripts work with Firefox 1.5 (from IE) and I was looking for some debugging help to set me on the right track. I found this tool which seems to work very well: http://getahead.ltd.uk/ajax/venkman.
It’s an updated version of Venkman fixed to work with Firefox 1.5.
One of the things it helped me find is that whereas in IE if I ask a table cell (TD) for the nextSibling and get the next TD, in Firefox you always seem to get a text node first and then the next TD. Similarly for getting the next and previous rows.
Note: See the May 2008 update at the bottom of this article.
alert("You are here") around the code to find out what’s going on. The problems with this approach are that you can’t easily switch them on and off without going through and commenting out individual calls; the fact that you get a dialog box up which needs to be accepted by the user can affect time-sensitive code, so you might not be able to debug it using this method; and finally it’s difficult to compare values from one
alert to the next since the text just comes up in a dialog box.