A year of progress for build automation, testing tools, and IDEs Tools for the software development lifecycle, or SDLC, moved to the forefront in 2008. For this Year in Review feature, tools expert John Ferguson Smart homes in on what’s new and improved about his favorite build-automation frameworks, testing tools, and IDEs. If you haven’t been keeping up on the tools front, here’s your chance to modernize your Java toolbox, just in time for the new year.In any age or industry, keeping your tools well honed is key to success. If you’re not using the latest and greatest in flint spear tips, you can’t hunt mammoths as well as the tribe over the next hill. Software development is no exception: staying on top of development tools and techniques requires constant vigilance. This article takes a look at some of the highlights of 2008 in the world of Java software development lifecycle (SDLC) tools, namely build-automation tools, testing tools, and IDEs. I’ll present a survey of how tools in these areas have progressed, in many cases by optimizing and adding new features favorable to developers. Along the way, I’ll also discuss the big picture behind some of these improvements — such as mainstream adoption of CI, the rise of scripting on the JVM, and increasing demand for tools that support programming for multicore systems. Let the tour begin!Build automationI’ll start with one of the cornerstones of any modern software development process: build automation. In the broad sense, build automation includes continuous integration (CI) tools of course, but also build-scripting tools, code-quality metrics tools, and version-control, or SCM repositories. The first stage of build automation is an automated build script. Traditional tools such as Apache Maven and Apache Ant, as well as newcomers Gant and Gradle, facilitate build scripting. In 2008, I saw many large organizations move toward Maven, attracted by the possibility of standardizing their development practices across multiple teams and imposing a more coherent, transparent architecture on their internal software components. This trend certainly looks set to continue in 2009.Maven: New and upcoming featuresIn 2008, Maven 2 version 2.0.9, the final version of the Maven 2.0 series, was released. Maven 2.0.9 fixes bugs and adds a few new features. One of its nicer improvements is better stability: as of Maven 2.0.9, the default versions of the lifecycle plugins (which implement all the core Maven features) are bound to the version of Maven. This means that lifecycle plugin versions can’t be updated behind the scenes as new releases appear, a habit that could occasionally result in unpredictable build behavior. Another nice feature is the ability to override the dependencies used in plugins; for example, you can update the version of Checkstyle used by the Checkstyle plugin.However, the most active area of Maven development has been dedicated to the upcoming new major release, Maven 2.1, due to come out in early 2009. This new version will contain many performance improvements and optimizations, including a more refined build algorithm for multi-module projects, and the possibility to download unrelated dependencies in parallel, rather than sequentially as we do today. For the moment, however, this development work has been visible to the broader public only in the form of the highly dynamic m2eclipse plugin. Although it is still a little unstable in some areas, this plugin positions Eclipse as the platform of choice for Maven development, providing a full and feature-rich graphical editor for the Maven pom.xml file. Features such as the Dependency Graph (see Figure 1) and Dependency Hierarchy, for example, make it much easier to visualize your project dependencies and to understand and resolve dependency conflicts that can occur when different libraries require different versions of the same third-party library.Figure 1. The Dependency Graph and the Maven Index View, two of the many useful features in the m2eclipse plugin (Click to enlarge.)Dependency-search is another feature of m2eclipse that, once you use it, you won’t be able to do without. It makes adding new dependencies to your project a non-event. Gone are the days of hunting the Internet for the correct dependency references. Now you simply search the Maven repository by name and pick the version you want to include it in your pom.xml file.A Maven repository manager is another tool that no serious Maven user could easily go without. A Maven repository acts both as a cache for dependencies downloaded from the public repositories on the Internet, and as a repository for libraries published and shared within the organization. 2008 saw the emergence of a new leader in this field, in the form of Nexus. Nexus is easy to use and configure, making administration of a Maven repository a real pleasure. Gant and Gradle steal Ant’s thunderThe traditional Java build-scripting tool, Ant, evolved little over the past year. Gant, in contrast, has been developing at a rapid pace. Gant is a build-scripting tool that lets you use Groovy rather than XML to build Ant tasks. Gant is notably the underlying build tool of the promising Grails Web framework, which also progressed by leaps and bounds this year (more on Grails later). For anyone who can’t live without the flexibility of Ant, but doesn’t like the wordy XML syntax, Gant is worth a look.In a similar vein, Gradle is another promising Groovy-based build tool that made its debut in 2008. Like Gant, Gradle tries to provide Ant’s flexibility with a Groovy syntax, but it also lets you leverage many Maven-like features such as transitive dependency management and convention over configuration.CI integral to SDLCThe Java development world in 2008 is clearly moving beyond seeing continuous integration tool and frameworks as glorified schedulers, now viewing them as key to the whole SDLC infrastructure. Build metrics, for instance, are a great way to keep tabs on your development process as a whole. A good CI tool lets you keep track not only of the number of tests, and test failures, in the latest build, but also of how your tests are doing over time. This sort of data can also be used to fine-tune the development process. Hudson a developer favoriteIn the past year Hudson has evolved from a nascent product to one of the more popular open source CI servers on the market. Although Hudson’s dynamism sometimes comes at the cost of minor glitches, its intuitive user interface and slick reporting features make it a great little CI tool. Hudson also leads the market in Maven integration, being the only tool, currently, that can correctly decide which projects need to be rebuilt based on the Maven dependency graphs. This can save you a lot of work when you have complex, multi-module Maven projects. Hudson also comes with a rich library of plugins, allowing you to add features such as integration with JIRA or Trac, or automated deployment onto a Tomcat server.Take the running time, or duration, of a typical build as an example. A slow build slows down the development cycle and discourages developers from building and testing locally and often (as the mantra goes). Knowing that a unit test failed in the last build is useful, and it lets you correct the issue quickly while the changes you made are fresh in your mind. But if a build failure persists over a dozen successive builds, this could indicate a deeper technical or organizational problem that the team leader might want to investigate. Similarly, a sudden increase in test duration can indicate a potential performance degradation, data that has practical uses in a development project.Figure 2 shows a graph of build duration over time. The build duration here was considered to be too long; in build 8, build-optimization work brought the average build duration from 15 minutes down to around 2.Figure 2. Build metrics, such as build duration over time, can be used to spot inefficiencies in the build processThis sort of optimization would clearly be much harder without good tool support. CI practices add a new dimension into code-metrics tools by enabling developers to display and analyze code metrics over time. This is one of the more significant innovations in CI over the last year or two. Bamboo, a commercial CI tool from Atlassian, has introduced many powerful features in this area, including graphs showing both build duration over time and individual test duration over time. CI and code-quality tool integrationSome CI tools provide excellent integration for code-quality tools such as Checkstyle, PMD, FindBugs, Cobertura, and Emma. These tools provide useful snapshots of different aspects of your project’s general health, in terms of coding standards, dubious practices and dodgy code, and code coverage. Hudson and Bamboo show not only the number of issues raised for a given build, but also the number of issues over time. The open source code-quality tools themselves are relatively stable. This year saw the emergence of a few new Checkstyle features and an ever-growing FindBugs rules database. On the commercial front, Clover has been releasing many innovative new features, including per-test coverage, which lets you see not only how often your application code was executed during tests, but also which tests executed the code.In other areas, 2008 has seen CI emerge from the exclusive domain of the build master or technical team lead to take on a much more democratic role. For example, in Hudson, one plugin lets a developer “claim” a failed build, to indicate the probable cause and let colleagues know that he or she is working on it. In Bamboo, you can add comments to builds, or start an IM discussion among developers from a build-failure notification. Hudson even has a “CI Game” plugin that lets team members compete for points awarded for improvements to the overall quality of the application code base.Subversion 1.5 releasedIn the version-control repository space, the big news of 2008 was the long-awaited release of Subversion 1.5. It introduces several powerful new features including merge tracking and improved support for replicated repositories. The new merge features make merging changes in different branches an order of magnitude easier. In previous versions, to merge changes related to a bug fix in a release branch back into the main trunk, for example, you needed to work out by hand exactly which revisions were involved in these changes. Any error would result in corrupted source code. In Subversion 1.5, you simply specify the branch from which you want to merge your changes, and Subversion figures out the rest, integrating only the changes made since the last time you merged.The impacts of this new feature should not be underestimated; they open the door to new possibilities of build automation based around Subversion. For example, some teams work with a stable Subversion trunk using only production code, and branches dedicated to work on new features. When a feature is finished, it is merged into the trunk for release into the next production release. The problem with this approach is that it makes CI difficult and tends to push back the integration stage, effectively neutralizing the benefits of CI. With Subversion 1.5, you could set up an integration branch that would automatically merge changes made in each feature branch. Any merge conflict or integration error could therefore be raised at an early stage, rather than much later on in the process. Testing toolsMuch has happened in 2008 for Java-based testing tools. In particular, the year saw a growing interest in behavior-driven development (BDD) testing frameworks, and Web testing tools have been making significant strides.Testing tools tackle executable requirementsBDD is a new take on the test-driven development (TDD) techniques popular in Agile circles. By moving the focus of testing activity away from testing as such, and toward expressing your requirements in executable form, you can obtain a much more precise design and development cycle.Version 2.0 of JBehave was released in September 2008. JBehave is a Java BDD framework in which you write BDD scenarios using special JUnit test cases along with special annotations such as @Given, @When, and @Then. You also write a corresponding text scenario, which lets you write your behavior stories before you implement the solutions. Listing 2 shows a simple test case. Listing 1. Simple JBehave test casepublic class AccountDepositSteps extends Steps { Account account = null; BigDecimal initialDeposit = new BigDecimal("100.00"); @Given("I have created a new account") public void createAccount() { account = new Account(); } @When("I deposit $100 into the account") public void deposit() { account.makeDeposit(initialDeposit); } @Then("My account should have a balance of $100") public void checkBalance() { ensureThat(account.getBalance(), equalTo(initialDeposit)); } } A new Groovy-based BDD framework, easyb, brings the considerable power of Groovy and the structured approach of BDD to the field of Java testing. Easyb uses a Groovy domain-specific language (DSL) that follows the BDD scenario pattern. Groovy scripting can make tests an order of magnitude more expressive, especially if you are familiar with Groovy idioms such as file processing, collections, and closures. The test case in Listing 1 would be written in easyb as shown in Listing 2.Listing 2. Easyb test casescenario "Make initial deposit onto a new account", { given "I have created a new account",{ account = new Account() } when "I deposit $100 into the account", { initialAmount = 100 account.makeDeposit(initialAmount) } then "the balance should be equal to the amount deposited", { account.balance.shouldBe initialAmount } and "My account should have a balance of $100", { account.balance.shouldBeEqualTo initialAmount } } Web testing tools evolveThere’s more to testing than just unit testing. Web testing is another area where tools have evolved in 2008. Two tools are particularly worth keeping on your radar in this area: Selenium and Canoo WebTest.Selenium is an original testing tool that runs your Web tests in a browser. In 2008, the beta version of Selenium 1.0 finally came out, bringing better stability and a few more features. You can use Selenium for both functional and regression testing, by recording Selenium test scripts against a running application, and for TDD by writing Selenium test cases in Java or even Groovy. 2008 also saw the appearance of Selenium Grid, a promising tool that lets you distribute your tests across multiple servers and run tests in parallel or on platform-specific browsers. Canoo WebTest has also seen a lot of activity in 2008. This powerful Web testing framework is well-suited to a TDD or BDD approach. Using Canoo WebTest, you can write test cases for your Web applications in XML or Groovy. Canoo WebTest runs against a Web application and produces clear, detailed HTML test reports. Grails uses Canoo WebTest under the hood for its automatically generated functional tests. (Canoo Web Test is not quite as versatile as Selenium, though: because it simulates JavaScript rather than actually executing it in a browser, its JavaScript support is not as good as Selenium’s.)IDEsOn the IDE front, 2008 saw the releases of Eclipse 3.4 Ganymede and of NetBeans 6.5, both with a passel of new features.Eclipse 3.4 comes with an enhanced Java development environment with many improvements in the contextual assistance features, better quick fixes, and a host of improved usability features. One nice new refactoring feature is the Extract Class option, which lets you take a group of variables and methods from a class and create a new class encapsulating these fields and methods. Compilation is also a lot faster in Eclipse 3.4, which can take advantage of multicore processors by spreading the work across several cores. And Eclipse 3.4 supports Subversion out of the box, thanks to the now fully integrated Subversive plugin. This provides a nicer out-of-the-box experience, though some more experienced users might still want to install the alternative Subclipse plugin instead. Groovy, Grails, and IDEsGroovy and Grails made large inroads into the Java community this year. Groovy is a dynamic scripting language described by some as “Java, as it would have been implemented in the 21st century.” Grails is a powerful, Ruby-like Web framework based on Groovy. With Grails, you can create a working CRUD application literally within minutes, thanks to a combination of tools and convention-over-configuration. In addition, for Java developers, Grails has the reassuring appeal of being built on top of familiar open source Java libraries such as Spring, Hibernate, and Lucene, and being compatible with standard Java Web application servers.One of the barriers to the use of Groovy and Grails, and of any of the newer dynamic languages such as Scala and Clojure, has been a lack of IDE support. Dynamic language support in IDEs is hard to implement because of those languages’ typeless nature. For example, it’s difficult, though certainly not impossible, to provide good code-completion features. IntelliJ is currently the best IDE on the market for programming in Groovy and Grails. The support in Eclipse is much less sophisticated, making the user experience for Groovy developers on this platform quite frustrating. NetBeans 6.5 has good support for dynamic languages (although not as good as IntelliJ’s). Nevertheless, 2009 promises to bring improved tool support for dynamic languages across the board.But my favorite Eclipse 3.4 feature has to be Mylyn 3.0. In a nutshell, Mylyn is a quite brilliant tool that integrates issue-management tools such as JIRA and Bugzilla into Eclipse. It helps you work more efficiently by displaying only the information relevant to the task you are currently dealing with. Mylyn has been integrated into Eclipse since the Europa edition, which came with Mylyn 2.0. Mylyn 3.0 provides many new and improved features, such as the ability to create tasks offline (great for plane trips), and to create tasks from any of the Eclipse marker views (Problems, Tasks, Bookmarks, and so on), or even from a failed JUnit test!NetBeans coming of ageWith its latest release, NetBeans is becoming a pleasant development environment indeed. As always, it offers a smoother user experience than Eclipse, though at the cost of a shorter list of available plugins. Good news for Maven users: with NetBeans 6.5, the IDE has become more Maven-friendly. Although not as rich as the m2eclipse plugin for Eclipse, the NetBeans Maven plugin is of good quality and treats Maven projects as first-class citizens.NetBeans 6.5 provides excellent support for a range of dynamic languages, including JavaScript, Groovy and Grails, PHP, and even Ruby/Rails. You can create projects using all of these languages, and NetBeans provides an efficient development environment for each of them. The code completion for Groovy, for example, is pretty smart and does a decent job of guessing object types based on how they are used. And you can create, and work with, Grails applications pretty much out of the box. NetBeans 6.5 is also the IDE of choice for working with JavaFX, Sun’s new up-and-coming rich Internet application (RIA) platform, via an optional plugin that makes creating and debugging JavaFX applications a real pleasure.Finally, NetBeans 6.5 provides improved native support for libraries such as Spring, Hibernate, and JavaServer Faces (JSF), with features such as a “Go to Spring Bean” dialog, and support for executing Hibernate Query Language (HQL) queries from within the IDE.In conclusion2008 was an eventful year on the tools front. Development environments are becoming more feature-rich and easier to use, and they’re adding capabilities to meet the increasing use of dynamic languages such as Groovy and Ruby. The growing interest in these dynamic languages was indeed another clearly visible trend in 2008. And if there was an overall trend in the build-automation tools of 2008, you could say that it is one of democratization. Groovy is making headway into the testing domain, making it easier for developers to write much more expressive and powerful tests. Tools like Hudson and Bamboo are taking CI out of the hands of dedicated specialists, and involving the development team members more and more. Maven is becoming easier to use, now boasting a rich user interface that makes it that much easier to understand a new build script or to work on an existing one. And the new features of Subversion 1.5 make exiting new automation scenarios feasible. So what is your team going to automate next? John Ferguson Smart is a consultant specializing in enterprise Java, Web development, and open source technologies, currently based in Wellington, New Zealand. Well known in the Java community for his many published articles, John helps organizations optimize their Java development processes and infrastructures and provides training and mentoring in open source technologies, SDLC tools, and agile development processes. John is principal consultant at Wakaleo Consulting, a company that provides consulting, training, and mentoring services in enterprise Java and agile development. He is also the author of Java Power Tools (O’Reilly Media, 2008). Open SourceSoftware DevelopmentBuild AutomationApp TestingDevelopment ToolsJava