Writing Selenium Tests for the GlassFish Admin Console
Thursday, March 25, 2010 |One of the results of the Oracle purchase of Sun has been an increased focus on testing — not that we didn’t test GlassFish before, but it was mostly manual in my area of the server. The task of automating this fell to me, and, after a little — ahem — testing, I settled on Selenium.
For those that don’t know, Selenium is a web application testing tool. It has a number of different modules, including the Selenium IDE, which is used to help write tests, and Selenium RC to run the tests. Selenium server, which actually interacts with the browser, is, for us, a transitive dependency through RC.
At any rate, I’ve been working on a number of tests for the GlassFish Admin Console to try to cover as much of what we currently have running as possible. At some point, I need to get out of writing tests and back to writing code, so I need to document what I’ve done, which is where this post comes in. I started out writing a step-by-step tutorial on how I use Selenium, but that was almost guaranteed to be hard to follow, so I created a screencast (using screencast-o-matic, incidentally, which is a Java-based tool. It runs on any platform, with no installation required. It’s pretty slick : ). What you’re about to see, then, is a demonstration of how I’ve written the 40+ tests we have so far. Nothing says this is the only way to do it, but I’ve found it pretty fast and effective.
Without further ado, then, I present the Jason Lee masterpiece,
Instant classic!