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

Advertisements

Tutorial: Most simple Test Application for Embedded Glassfish + Netbeans + Hudson

With Glassfish V3 (or better with Java EE6 and EJB 3.1) it becomes way easier to test EJB’s, which is now possible to do with the embedded Glassfish. Lets have a quick and very basic walk-through and highlights some of the current issues and pitfalls.

Pre-Requirements:

  • Netbeans 6.8
  • Glassfish V3
  • optional: a Hudson installation (at a remote server) with a local Glassfish V3 installation

Tutorial:

  • Create a new Web Application WebTestEmb
    Standard EE6 project with a local or remote GF, no frameworks
    Activate local lib-folder and use dedicated lib folder for server libraries !

    New Web Application

    Continue reading

Tutorial: Getting started with Netbeans and JUnit plus Cobertura and Hudson (Part 3)

Following part 1 and 2 which covered the JUnit test class creation and the coverage evaluation by Cobertura, we will add in part 3 another dimension: Automation. So far we run the tests manually, but we want to achieve a continuous integration and test environment.

Part 3 (Cobertura and Hudson)

Preparation:

Tutorial: Getting started with Netbeans and JUnit plus Cobertura (Part 1)

I believe strongly in testing. I saw companies and products without any automatic test frameworks and the slightest change to the codebase (often in the urgent ‘we-need-to-fix-it-now-and-give-to-the-customer-in-1hr’ mode) made parts of the product or modules prone to crashes because no one could test the changes against the complete application. In my current endevour to create a new product we embrace testing, though we dont practice TDD (test-driven-development), but at least we maximize the amount of automatic testing with tools/frameworks like Netbeans, Hudson, Cobertura and others. If you dont practice TDD, how can you judge how much of your codebase is really tested, even you assume all you business testcases are covered ?

The other day Code Coverage crossed my way (Thanks Chris!). Eager to find out how to “do it” or to “use it” I found a few tools suitable for the Netbeans environment. It actually drilled down to only one tool: Cobertura. It fits exactly into our landscape using Netbeans and Hudson and it is opensource.
To get started with Cobertura you should be familiar (a bit) with Netbeans, JUnit and Ant. The Cobertura website offers sufficient reference for all functions and introduction to get you started. But what I missed is a tutorial the start from the scratch using Netbeans and Cobertura. I found 3 references (I will add them at the end,) which are not complete or just not working for me), so let me share the most basic getting-started steps with you.
Please note: This is how I get started, it might not be complete, foolproof or even correct in all details. Please feel free to comment, correct or give other feedback !

Continue reading