Here's a conversation I just had with another developer who is struggling to get his team to adopt some agile practices:
developer: if you were starting from scratch, which would you think is more important to setup first? CI or a unit testing process?
me: unit testing
me: why is that surprising?
developer: i look at the mess i'm in everyday and i'd think getting a good build system in place would be first...
me: I think unit testing provides more value in that it allows you to add features knowing you haven't broken other features
developer: testing above a development process?
me: testing provides more customer value
Let me be clear in stating that I think both are great value and a necessity, however the challenge was to choose one, presumably the most important. I chose unit testing because one of the reasons I enjoy writing software that meets someone's needs. As a developer one of the most nervous moments is when your code is released into the wild. Will it work? Will users they use it how you intended? As a developer one of the most satisfying experiences is watching a user fire up a program you've written and it works flawlessly. I think most customers would agree with that as well. Having code that works is what they want. Having code that works builds their confidence in you and reassures them that know what you're doing. Testing provides this for me. In advance I can test different scenarios and program that in and put my program through it's paces.
Now let me speak a bit about CI. While I believe that testing is a component of CI, the developer in this instance meant a build server that kicks off automated builds. While an automated build is nice, it doesn't nearly provide the value that unit testing does. It's the things your build server does that increases it's value. One of those things in our build system is running automated tests. If you remove automated tests from a build server all you have is a dummy machine that compiles code. That provides some benefit, but minimally. You can replicate the behavior simply by updating your code often and doing a compile on your own machine.
As an agile developer I seek deliver value to stakeholders. When viewed through that lens, I think unit testing clearly wins.
What about you? Would you test before build server? Or would you choose the build server? Why?
08-19-2008 2:14 PM