InfoQ

Article

Book Excerpt: Continuous Integration means Continuous Testing

Posted by Paul Duvall, Steve Matyas, Andrew Glover on Aug 05, 2007 01:16 AM

Community
Agile
Topics
Delivering Quality,
Agile Techniques
Tags
JUnit,
TDD,
Testing,
DbUnit,
Continuous Integration,
Selenium,
Fit / Fitnesse,
TestNG

Continuous Integration (CI) is a basic Extreme Programming (XP) practice, but it is also used by teams that would never consider XP for their work. Martin Fowler has pointed out that, at this point, it's become an essential part of any competent software development activity. In their book Continuous Integration: Improving Software Quality and Reducing Risk, Paul Duvall, Steve Matyas and Andrew Glover aim to help teams make this important practice a "non event" on their projects - something that happens unobtrusively and as a matter of course. When successfully implemented, CI ensures that any individual developer's work is only a few hours away from a shared project state and can integrated back into that state in minutes. InfoQ presents a pdf download (14MB) of Chapter 6: Continuous Testing, which presents strategies for writing the different kinds of tests required to ensure system quality.

RelatedVendorContent

Agile Metrics Tracking and Mingle Podcast + Transcript

Scaling Agile on large teams & Being Agile every day Tracks @ QCon SF Nov 19-21

Agile Tool Evaluation Guide

The Agile Business Analyst: Skills and Techniques needed for Agile

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.

Testing is a key area for CI improvement, since the bulk of an application's build time is usually applied to running tests. Poorly constructed test suites can cause build times to bog down, at which point teams start to circumvent their own agreed-upon CI practices just to recapture the time they need to code. These shortcuts increase the likelihood of "red" (broken) builds, and can lead to a "broken windows" scenario in which it's impossible to judge code quality because the build runs "red" more often than not, increasing the risk of serious production flaws, and provoking the addition of lengthy pre-release testing that delays deployment.

In this chapter on testing the authors describe the following topics and the relationships between them:

  • Automate unit tests
    Automate your unit tests, preferably with a unit testing framework such as NUnit or JUnit. These unit tests should have no external dependencies such as a file system or database.
  • Automate component tests
    Automate your component tests with unit testing frameworks such as JUnit, NUnit, DbUnit, and NDbUnit if you are using a database. These tests involve more objects and typically take much longer to run than unit tests.
  • Automate system tests
    System tests are longer to run than component tests and usually involve multiple components.
  • Automate functional tests
    Functional tests can be automated using tools like Selenium (for Web applications) and Abbot for GUI applications. Functional tests operate from a user’s perspective and are typically the longest running tests in your automated test suite.
  • Categorize developer tests
    By categorizing your tests into distinct “buckets,” you can run slower running tests (e.g., component) at different intervals than faster running tests (e.g., unit).
  • Run faster tests first
    Run your unit tests prior to running component, system, and functional tests. You can achieve this by categorizing your tests.
  • Write tests for defects
    Increase your code coverage by writing tests based on new defects and ensuring that the defect does not surface again.
  • Make component tests repeatable
    Use database testing frameworks to make certain that the data is a “known state,” which helps make component tests repeatable.
The chapter ends with a series of questions teams may use to evaluate their own CI  test process:
Are you categorizing your automated tests, such as unit tests, component tests, system tests, and functional tests?

Are you configuring your CI system to run each test category with different staged builds?

Are you writing automated unit tests for each defect?

How many asserts are in each of your test cases? Are you limiting each test case to one assert?

Are these tests automatable? Has your project committed automated developer tests to the version control repository?
The chapter is amply illustrated with examples from various testing frameworks, including TestNG, Ruby, DbUnit, StrutsTest, Selenium and JUnit.

Read the InfoQ exclusive excerpt: Chapter 6: Continuous Testing from the book Continuous Integration: Improving Software Quality and Reducing Risk by Paul Duvall with Steve Matyas and Andrew Glover. Have a look at the full table of contents on O'Reilly Safari for an idea of the other topics covered in the book.

5 comments

Reply

Link broken by Michael Hunger Posted Aug 12, 2007 2:59 AM
Link broken by Nikita Salnikov-Tarnovski Posted Aug 14, 2007 7:47 AM
Re: Link broken by Majid Latif Posted Aug 14, 2007 3:27 PM
Re: Link broken by Floyd Marinescu Posted Aug 14, 2007 10:31 PM
Re: Link broken by osman geldi Posted Jul 20, 2008 10:04 AM
  1. Back to top

    Link broken

    Aug 12, 2007 2:59 AM by Michael Hunger

    the download link is broken. Please fix it. Michael

  2. Back to top

    Link broken

    Aug 14, 2007 7:47 AM by Nikita Salnikov-Tarnovski

    +1

  3. Back to top

    Re: Link broken

    Aug 14, 2007 3:27 PM by Majid Latif

    ++

  4. Back to top

    Re: Link broken

    Aug 14, 2007 10:31 PM by Floyd Marinescu

    Many apologies, it has been fixed. So sorry!

  5. Back to top

    Re: Link broken

    Jul 20, 2008 10:04 AM by osman geldi

    client for Windows that can be used to communicate, share, play or work with others on IRC networks around the world, either in multi-user group conferences or in one-to-one private discussions. It has a clean, practical interface that is highly configurable and supports features such as buddy lists Sohbet Chat travesti travesti travesti travesti travesti geciktirici sex shop sex penis büyütücü chat adult forum redtube 89 sex shop erotik shop şişme bebek sikiş file transfers, multi-server connections, SSL encryption, proxy support, UTF-8 display, customizable sounds, spoken messages, tray notifications, message logging, and more. mIRC also has a powerful scripting language that can be used both to automate mIRC and to create applications that perform a wide range of functions from network communications to playing games. mIRC has been in development for over a decade and is constantly being improved and updated with new technologies. The latest news about mIRC can be found on the latest news page.

Exclusive Content

An Overview of the eXo Platform

Mestrallet and Grall cover the eXo platform, the Portlet 1.0 (JSR 168) and 2.0 (JSR 286) specs, eXo Web 2.0 Portal, JSR 286 Inter-portlet communication, eXo JCR and eXo Enterprise Content Management.

The Top 10 Ways to Botch Enterprise Java Application Scalability and Reliability

Purdy discusses Java scaling, performance vs scaling, rewriting frameworks, databases, bottlenecks, abstractions, disaster recovery, one-size-fits-all architecture, big JVM heaps and network failures.

Building Scalability and Achieving Performance: A Virtual Panel

Our panel of leading experts explores some of the challenges and thought processes that go into making their apps as scalable and performant as possible.

Domain-Driven Design in an Evolving Architecture

Mat Wall and Nik Silver explain how their has been using Domain-Driven Design in an evolving and Agile environment, at high traffic news site guardian.co.uk.

Avi Bryant on DabbleDB, Smalltalk and Persistence

In this interview, Avi Bryant talks about the Smalltalk web framework Seaside, DabbleDB, using Smalltalk images for persistence instead of an RDBMs, GemStone and more.

Book Review: Agile Adoption Patterns, A Roadmap to Organizational Success

With Agile adoption, context is everything: this book offers patterns and tools to help determine which practices most contribute to meeting your organization's goals.

Rob Windsor on WCF with REST, JSON and RSS

WCF is not just for SOAP based services and can be used with popular protocols like RSS, REST and JSON. Join Rob Windsor as he introduces WCF 3.5 and its new native support for non-SOAP services.

Christophe Coenraets Discusses Flex 3, AIR, and BlazeDS

Christophe Coenraets discusses Flex 3, Flex Builder, AIR, BlazeDS, Adobe and open source, integrating Flex with existing applications, and integrating RIAs with search engines and browsers.