Agile in small steps #1: Unit testing

Posted on April 10th, 2007 in Agile, Agile in small steps by siddharta || No Comment

This post is part of the Agile in small steps series. For a complete list of posts in this series, click here.

One of the core principles of agile software development is to get rapid feedback and adjust accordingly. It goes without saying then, that the quicker you can get feedback the faster you can adapt. One of the simplest ways of reducing this time is by unit testing your own code.

Imagine this: You write some code for a few days, then check it into version control. A month later a build goes to QA. A few weeks after that a bug report is filed. Then the bug is triaged and assigned. By the time the bug comes back to you for fixing you’ve forgotten the code you were working on. Familiar?

Had you written unit tests, you would have caught the bug right when you were working on the code.

Writing unit tests have a number of advantages

  1. It clarifies the requirements in your mind. You understand the expected outcome better.
  2. It reduces the feedback cycle from coding to bug detection
  3. It allows you to run through all the tests quickly

The nice thing about unit testing is that you are not dependent on anyone else to adopt this practice. If you are a developer, you can unit test your own code even if no one else in the company is doing it. If you are a project manager, you can adopt unit testing for your team even if none of the other teams are doing it. Most languages have a simple and standard unit testing framework that is easy to use. Learn it and use it.

If you take unit testing a step further and introduce it to the whole team, a few more advantages come up

  1. Unit tests act as regression tests and can be run on a regular schedule
  2. Because unit tests are automated, you can run it at a much higher frequency than manual tests
  3. Unit tests help with refactoring messy code
  4. Unit testing can be integrated into a continuous integration system
  5. Making code testable improves the design of the code by reducing external dependencies.

So thats agile in small steps #1: Unit testing

Doing Distributed Agile?

Share and collaborate with distributed teams with our electronic agile board tools. Get all the benefits of electronic tools without sacrificing the benefits of physical boards. Supports Scrum taskboards, Kanban boards and user story maps. Check it out!

Leave a Reply