Quick Tutorial: Netbeans + Selenium + Hudson (Part 2)

In part 1 of this tutorial (I recommend to walk through it first) we created a simple web application, set up a Hudson server to build it and test it with Selenium. But we left with one major flaw: Hudson build the war file, but the JUnit test the job triggered was tesing an application already deployed to a Glassfish instance. Today we wipe out this problem, setting up a proper sequence of building, deploying and testing the application.

Pre-Requirements (same as in part 1):

  • Netbeans 6.9 (earlier versions certainly work as well)
  • Glassfish
    A local Glassfish that comes with Netbeans is good enough. I am using a Glassfish 3.0.1 running in a VirtualBox.
  • Hudson Server
    Download the war file from here. For the tutorial we will use a local standalone Hudson server.
  • Selenium RC
    Download from here.
  • Sourcecode Repository (SVN)
    In order to use Hudson, it is recommended to have a sourcecode repository like SVN to upload the code.

Tutorial:
Continue reading

Quick Tutorial: Netbeans + Selenium + Hudson

Selenium is one of the most powerful web application test tool I know. It supports a wide range of Browsers, Operating Systems, Languages and Test Frameworks (find all infos here). It takes a while to learn all the commands in the API that you can use to test your web application, fortunately there are some plugins  that help you to get started. Although I found it confusing to get started with Netbeans and Hudson, each having its own plugin, plus Firefox also offering a plugin, and some websites and tutorials leading in different directions (if you are in hurry like me).

This short tutorial walks you through the steps to get started in a few minutes.

Remarks:

  • A CI or build-server is usually headless, means there is no desktop, no Gnome, no GUI, so would not be possible for Selenium to start and control a browser. This tutorial assumes you run a build-server with desktop. At a later stage we will discuss the headless testing.
  • In this tutorial we will implement a simple JSP web application with 2 pages and create a JUnit test triggering the Selenium Test.
  • The Netbeans plugin and Hudson plugin for Selenium is not required for this tutorial.
  • The tutorial is created with Ubuntu as OS (Windows should be similar)

Pre-Requirements:

  • Netbeans 6.8 (earlier versions certainly work as well)
  • Glassfish
    A local Glassfish that comes with Netbeans is good enough.
  • Hudson Server
    Download the war file from here. For the tutorial we will use a local standalone Hudson server.
  • Selenium RC
    Download from here.
  • Sourcecode Repository (SVN)
    In order to use Hudson, it is recommended to have a sourcecode repository like SVN to upload the code.

Continue reading