Selenium, a test-tool for Web Applications, was the subject of one of the quicky presentations (15 minutes max) on JavaPolis this week. It is described as: Selenium is a test tool for web applications. Selenium tests run
directly in a browser, just as real users do. And they run in
Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh. I was not able to attend the presentation, but I got intrigued by the short description. I went to the website at http://www.openqa.org/selenium/index.html and browsed a little, trying the demos etc. My first impressions are very favorable: using a very simple scripting language, you instruct the test engine to navigate through a web-application, clicking buttons and links, settings values in form items all the while verifying the responses of the application. As attractive test-tools should do, it has good visual feedback, showing what tests passed and which ones failed. Note that it provides a very easy way of doing cross browser testing: ensuring that an application works on different browser (versions) on different operating systems.
I have downloaded Selenium and will try it out on one my of own web-applications. To get started is as simple as copying an entire directory to a web accessible directory in the same web server as the application you want to test. In Apache, this would mean a subdirectory of “htdocs”. For my web application, running from within JDeveloper 10.1.2, that meant under public_html but outside of WEB-INF. Once the application is running in the browser, the Selenium Self test can be started by pointing the browser to an html document in the Selenium directory just copied.
The next step obviously is creating a test for my own application. It takes a little getting used to the syntax of the commands, but it took me less than 15 minutes to get started with testing the application. I have navigated to the login-page, entered values in the username and password fields, clicked a button to submit by login attempt, navigated to the first page in the application and verified its title. Not bad for a first encounter of a close kind. Definitely worth looking into, this tool!
My first test-script:
|Test Entering the contacts application|