
gile development is the new paradigm! (Are you rolling your eyes yet?) Yes, "paradigm" is an overused word but hype aside, agile development does offer some interesting best practices that might turn on its head how you think about developing software. One such practice is
test-driven development (TDD), which has gotten a bit of notoriety lately thanks to its association with Extreme Programming.

The basic premise of TDD is to always write an automated test for a piece of functionality first, before you code up the functionality itself. Having an automated test suite ensures that you only ever provide the simplest implementation of the code so that the new test passes. You then write more tests and accordingly alter and extend, or refactor, the application code to get you where you want to be. In this article I will show the rhythm of this approach in development and introduce the one of the available tools for VB6. I'll walk through a simple example, where the focus is on the approach, rather than design or coding problems.
Rhythm
Proponents of this style of development frequently speak about the rhythm of TDD, which consists of:
- Write a failing test
 | |
| Figure 1. Green Bar of Freedom: The vbUnitFree Test Runner gives a green bar to indicate all tests have passed. |
- Get the test running
- Get the test passing
- Refactor out any duplication
- Rinse and repeat.
The tool that I'll be using is vbUnit, a Visual Basic implementation of the xUnit design. XUnit is the name given to the testing framework design originally created by Kent Beck, the founder of Extreme Programming. JUnit is the most widely used implementation, but it has been ported to more than 30 different languages, so you can safely consider it to be an industry standard. As is customary with xUnit tools, in vbUnit a red bar means that at least one test failed; a green bar means that all tests passed and you can move on to "rhythm" step 4 (see Figure 1).