InfoQ

News

Continuous Integration and Code Inspection with Hudson and FindBugs

Posted by Srini Penchikala on Dec 14, 2007

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

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

Watch Thread Reply

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.