Programmatic testing with Selenium and TestNG
In the latest “In pursuit of code quality” installment, entitled “Programmatic testing with Selenium and TestNG”, author Andrew Glover provides a tutorial on user interface testing with Selenium, an open-source Web user interface testing framework that drives a user’s Web browser when performing tests.
While programmatic testing isn’t for everyone (non-developers will likely prefer Selenium’s Fit-style tables), it does give you access to TestNG’s exceptional flexibility….
TestNG is an especially good match for Selenium because it enables you to do some things that aren’t possible using other frameworks, such as test using dependencies, rerun failed tests, and set up parametric tests with the parameters defined in separate files.
…. and also allows you to build out your test framework with DbUnit and Cargo, thus ensuring the logical repeatability of your tests.
Don’t miss out on the code quality discussion forum where you can learn first-hand about code metrics, test frameworks, and writing quality-focused code.

June 1st, 2007 at 1:59 pm
I’m a fan of selenium for sure. In fact, i’d prefer to run a selenium tests outside of Fit, for example, using maven’s selenium plugin, or even just writing the test in java or groovy, and then starting up a selenium server on a nice large-numbered port and executing it as a regular junit test (pretty nifty). What i’m not sure i’m a fan of is TestNG in only one aspect: That i need to declare or use another file (xml) to specify how the test should run. Now, maybe i dont know too much about TestNG and maybe i’m missing the bigger picture, but i’m not really sure why i’d need anything else other than a java classfile and a selenium (or other FT tool) to run an acceptance test. The minute someone mentions that i need “another” file for config, i cringe and back off. Why “something else”? Testing should be simple, quick, effective. Just a thought, not a sermon.
July 3rd, 2008 at 4:17 pm
A config file is not required, but some folks like them. You can do entirely without config files - you can annotate all your test harnesses to comprise groups or suites based on your needs.