The Artima Developer Community
Sponsored Link

Java Community News
User Interface Testing with Selenium and TestNG

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

User Interface Testing with Selenium and TestNG Posted: Apr 5, 2007 6:30 PM
Reply to this message Reply
Summary
Selenium is an open-source Web user interface testing framework that drives a user's Web browser when performing tests. Andrew Glover's latest IBM developerWorks article provides an introduction to user interface testing with Selenium.
Advertisement

Selenium is an open-source Web client testing framework originally developed by ThoughtWorks for acceptance testing of an internal project. It has gained increasing popularity in the past year, mainly because it works directly with all the popular Web browsers, and also because it lets users define tests both programmatically as well as with Ward Cunningham's Fit-style tables.

In his latest IBM developerWorks article on code quality, Programmatic testing with Selenium and TestNG, Andrew Glover provides a tutorial on testing a Web user interface with Selenium. In introducing Selenium, Glover writes that,

Selenium is one of the first of a new breed of open source, browser-driving Web testing frameworks that automate user acceptance testing... Unlike most Web testing tools, which attempt to simulate HTTP requests, Selenium approaches Web testing as if it were the browser itself. When you run an automated Selenium test, the framework fires up a browser and actually drives the browser through the steps delineated in the test, just the way a user would do when interacting with your application.

Glover notes that Selenium consists of a lightweight server framework that interacts with the test code:

The Selenium architecture essentially consists of two logical entities: the test code you write and the Selenium server, which facilitates interactions with the application under test... the Selenium server is a lightweight process that can be programmatically started and stopped within the confines of an actual test.

To drive the test execution, Glover uses TestNG in the article:

One advantage of using Selenium programmatically with a framework like TestNG is that it allows you to create intelligent fixtures... 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.

Selenium's ability to perform tests by driving a user's browsers is possible because Selenium tests rely on ID elements on Web pages. It it the presence, or absence, or those IDs that allow Selenium to match tests with what the browser displays:

Programmatically interacting with Web pages is an exercise in using logical ids... The first step to interacting with a page element is to find it, which you can usually do using HTML element IDs. Selenium also allows you to use XPath, regular expressions, or even JavaScript to locate specific elements, if you so desire.

What tools do you use to test your Web application's user interface?

Topic: Charles Nutter on JRuby Performance Previous Topic   Next Topic Topic: Gavin King's Java EE 6 Wish List


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us