Jaslabs: High performance Software

High Performance Software

How to test a web application

By Justin Silverton

When creating and releasing a web application, testing is a very important step in the overall process. It can determine the success of an application and is many times a very time consuming process. There is an open source application called selenium that can help automate these steps and help reduce the risk of missing anything important while testing.

How it works

Selenium uses JavaScript and Iframes to embed a test automation engine in your browser. This technique should work with any JavaScript-enabled browser. Because different browsers handle JavaScript somewhat differently, we usually have to tweak the engine to support a wide range of browsers on Windows, Mac OS X and Linux. The beauty of this design is that it can also be used to test any web page or script (independent of the the back-end technology used to generate it).

Features

  • Easy record and playback
  • Intelligent field selection will use IDs, names, or XPath as needed
  • Autocomplete for all common Selenium commands
  • Walk through tests
  • Debug and set breakpoints
  • Save tests as HTML, Ruby scripts, or any other format
  • Support for Selenium user-extensions.js file
  • Option to automatically assert the title of every page

How to test your application

Testing comes in three flavors. The first is a simple GUI interface (either a firefox extension or through a back-end application for Internet Explorer) that allows the direct recording of any action in the browser. Below is a screenshot of this interface.

Test scripts can be created by the following steps:

  1. Install the Firefox extension
  2. Go to the website/page that you would like to start testing
  3. Click the and go through all of the steps for the test
  4. When you are finished, click the button from step 3 again to finish the test

You will notice some commands listed on the main screen. These are the commands that were recorded from above. These can also be added manually.

Another method for testing is using the selenium core. Selenium Core uses a unique mechanism which allows it to run on so many platforms. Written in pure JavaScript/DHTML, you copy Selenium Core tests directly into your your application webserver, allowing the tests to run in any supported browser on the client-side. It allows you to do the following:

  • Browser compatibility testing. Test your application to see if it works correctly on different browsers and operating systems. The same script can run on any Selenium platform.
  • System functional testing. Create regression tests to verify application functionality and user acceptance.

The third method for testing is through the Selenium Remote Control. Selenium Remote Control provides a Selenium Server, which can automatically start/stop/control any supported browser.

The Selenium Server communicates directly with the browser using AJAX (XmlHttpRequest). You can send commands directly to the Server using simple HTTP GET/POST requests; that means that you can use any programming language that can make HTTP requests to automate Selenium tests on the browser. Wrapper objects are also included for Java, .NET, Perl, Python, and Ruby.

Download

Selenium can be downloaded for free Here

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati

1 Comment so far

  1. chandrika BR October 15th, 2007 2:57 am

    Hi,

    Can i know which is the best approach for testing Java Based Web application Using Selenium.Since IDE supports testing on mozilla.
    Breif on the method to carry ahead to test on IE.

    regards,
    Chandrika

Leave a reply