Better software through debugging and unit testing -- Unit testing, Extreme Programming and TDD

Unit testing is a key element of Extreme Programming (XP) and test-driven development (TDD). These tips, tutorials and articles will help you understand unit testing in the frame of other methodologies.

   Software debugging basics
   Unit testing basics
   Unit testing, Extreme Programming and TDD
   Debugging for security
   Other useful resources

  Unit testing, XP and TDD

Unit testing is a key element of Extreme Programming (XP). A practitioner of XP, however will approach unit testing differently than an adherent of another software development methodology. XP practitioners follow test-driven development (TDD), which requires a style of unit testing that's quite intensive.

There are many tools and frameworks for unit testing, as this extensive list demonstrates. However, the mind behind XP created the first popular unit testing tool, which sparked the entire line of xUnit frameworks. The following links will mention many tools, but JUnit for Java and NUnit for -- you guessed it -- .NET come up most often.

  • Article: Unit tests -- Lessons learned -- This short introductory article from is a good place to begin learning about unit testing in the context of Extreme Programming. There are helpful links, including one to download a unit testing framework. For those lacking inspiration, the article also links to an older (2001) but relevant article from Ron Jeffries, Essential XP: Unit tests at 100.

  • Article: Advanced unit testing, part 1 -- Author Marc Clifton has a rather cynical view of unit testing and XP. "This is a meandering article on the issues of unit testing and the Extreme Programming (XP) process," he warns his audience. "And what's worse, this is Part I of four articles," he adds. But readers shouldn't be put off. This is a comprehensive, organized (in outline form, no less) tutorial on unit testing in general and how it applies to XP specifically. It is tailored to the beginner, and code samples and tool descriptions abound.

  • Article: The importance of unit testing -- This is a short and sweet introduction to unit testing and XP.

  • Article: Introduction to test-driven design (TDD) -- This is a clean, clear, well-organized description of TDD. There are numerous graphics, a "myths and misconceptions" chart and a host of links.

  • Article: Testing with JUnit -- This is a basic tutorial on how to use JUnit in Java applications. Those looking for more information on this tool may want to check out

  • Article: Testing project using NUnit -- A concise tutorial for beginners, heavy on the screenshots and code samples. "Testing .NET components using NUnit" is slightly heavier fair. And "NUnit allows effective unit testing with .NET applications" offers up a definition of test-first development, which in this case the author conflates with TDD. Like JUnit, NUnit has its own site -- for good measure.

  • Article: TDD design starter kit -- State vs. interaction testing -- Moving beyond regular (state) unit testing, Jeremy Miller explores a different perspective: interaction unit testing. He provides examples and explanations.

  • Tip: Using JMock in test-driven development -- This excellent tip from Paulo Caroli introduces the concepts of mock objects and TDD before delving into how to use the JMock tool. Caroli is generous with diagrams and code samples.

  • Article: Unit testing and test-driven development (TDD) for Flex and ActionScript 3.0 -- Valuable even if you aren't using Flex or ActionScript 3.0, this article offers another perspective on TDD and unit testing.

Visit our next section, Debugging for security, for information on how to find security flaws in software.

Dig Deeper on Topics Archive