InfoQ

News

Continuous Integration and Code Inspection with Hudson and FindBugs

Posted by Srini Penchikala on Dec 14, 2007 12:00 PM

Community
Java,
Agile
Topics
Artifacts & Tools,
Delivering Quality,
Open Source,
Configuration Management
Tags
JUnit,
TDD,
Testing,
Continuous Integration,
Subversion,
TestNG,
PMD,
FindBugs

A recent article published in IBM developerWorks talks about automating the Continuous Integration (CI) and Code Inspection tasks in a build process using open source tools. It explains how to install and configure Hudson, a CI server developed by java.net community, to poll a Subversion code repository and run an Ant build script anytime a change is detected in the source code.

The author Andrew Glover lists the following items as the three main components in a typical CI environment setup:

  • An automated build process with a build tool like Apache Ant.
  • A source code repository like CVS or Subversion.
  • A CI server such as Hudson.

Andrew uses a sample java application to show how to configure a java project in Hudson server for running automated builds. He also shows how to integrate code analysis and software inspection tools like FindBugs and PMD using Hudson's plug-in extensions.

The article explains how to use Hudson to capture the build process execution times and test trends. For each build, the CI server will parse the JUnit result XML files and build a trend graph showing how many tests were added between each application build. It also shows if the tests are passing (blue graph) or failing (red graph). The code violations or defects found using PMD and FindBugs can be tracked in each build for historical analysis.

Hudson can be configured to point to a SMTP server to send e-mails to the project team when the build fails. It also supports RSS as a notification mechanism so the team can subscribe to the project's Build Status page via RSS feeds.

Hudson has support for both JUnit and TestNG testing frameworks. It can also be integrated with SCM software such as CVS, ClearCase or Accurev and build tools like Maven or Gant. A full list of plugins on Hudson website shows its integration with different open source and commercial SCM, code coverage, and issue tracking tools.

In another article in developerWorks on the CI topic, Paul Duvall presents some best practices when setting up a CI environment and how to avoid, what he calls, the CI anti-patterns. These best practices are:

  • Developers should commit smaller chunks of code frequently rather than waiting for a long time and checking-in several changes at once.
  • CI server should notify the project team immediately when the build breaks.
  • It should use the feedback mechanisms like E-mail or RSS to communicate build status to the project team.
  • Build status feedback should be succinct and it should only contain relevant information about the build.
  • Build server should have sufficient hardware resources for faster builds.
  • The project team should follow a "build pipeline" approach to execute longer-running processes asynchronously.

 

Related Sponsor

VersionOne is recognized by Agile practitioners as the leader in Agile project management tools. Companies such as Adobe, BBC, CNN, Dow, HP, IBM, Sony and 3M have turned to VersionOne to help deliver greater value to their customers.

No comments

Reply

Exclusive Content

Tapestry for Nonbelievers

A new article by I. Drobiazko and R. Zubairov introduces v. 5 of the Apache Tapestry component-oriented web framework. The tutorial shows how to create a component and covers IoC in Tapestry and Ajax.

Pete Lacey on REST and Web Services

In this interview, Burton Group consultant Pete Lacey talks to Stefan Tilkov about his disillusionment with SOAP, his opinion on REST, and addresses some of the perceived shortcomings REST vs. WS-*.

Business Natural Languages Development in Ruby

Jay Fields presents his concept of Business Natural Languages - a type of Domain Specific Languages geared towards being readable by domain experts.

Distributed Version Control Systems: A Not-So-Quick Guide Through

Adoption and interest for Distributed Version Control Systems is constantly rising. We will introduce the concept of DVCS and have a look at 3 actors in the area: git, Mercurial and Bazaar.

Segundo Velasquez and Agile as Seen Through the Customer's Eyes

Deborah Hartmann interviewed Segundo Velasquez about his experience as customer with an Agile team during the initial phase of software design of a product.

Fine Grained Versioning with ClickOnce

David Cooksey shows how to fine grained versioning to a ClickOnce deployment using an HttpHandler written with ASP.NET, making partial rollouts to a test audience much easier.

Implementing Manual Activities in Windows Workflow

Windows workflow (WF) is an excellent framework for implementing business processes, but lacks support for human activities. This article describes a completely generic approach for changing this.

Markus Voelter about Software Architecture Documentation

In this interview taken during OOPSLA 2007, Markus Voelter talks about the importance of documenting the software architecture, and gives some good and also bad examples on how it could be done.