Who struggles embracing unit testing?

Will unit testing "come back and slap us in the face?"

Today I want to share with you a blog post that I just loved reading over the weekend: “Why bother writing unit tests?” by Justin J. Moses.

Take a minute and jump to it… and then we can come back and talk a little more about what you have just read. (Go ahead… I’ll wait here.)

Thanks for coming back! First, let me start by saying I love hearing someone else’s history with unit tests.

The energy that Justin showed in writing about kicking and fighting his way into becoming an advocate for unit tests teaches me a lot about what people experience in adopting a new approach like unit testing.

A different story of unit testing

In the mid-90’s, in the advent of Java in the browser (think applets and Netscape Communicator), I was working as a consultant integrating testing methods into the development life cycle for Chrysler Corporation as part of their QS9000 standards initiative.

A colleague and I were building a software testing and certification lab, buying & developing custom tools for registering and certifying apps and designing processes for better requirements, traceability, regression, scale and load testing.

We had lots of toys to play with, but the one idea that resonated with me most during this period was that business requirements were getting transformed too many times before software delivery.

If anything could help us write better software it would be reducing those transformations and knowing that we ultimately tested what we wrote and that we wrote what our customer wants. Simple enough, right?

(By the way, across the cube wall from us was another little Smalltalk project for the Chrysler payroll folks… but that’s a story for another time… and perhaps one of the reasons I lean more toward XP… again, a story for another time.)

Some of the side effects of Test-Driven Development

So Test-Driven Development solved many problems for me. Closer linkage of requirements to tests, and the suggestion that if we preserve that linkage and stick to the scope of our tests… some really great side effects can show up for us, like:

  1. No gold-plating
  2. Successively refined coding, and not out of control
  3. Simpler code
  4. A discipline that supports true continuous integration (CI)
  5. Test failures (with rigorous CI) offer a laser-focus on what changed & who worked on it over a short time interval
  6. (and probably many more)

If the bar is green, the code is clean?

And with the release of xUnit frameworks to support building and automating tests it seemed to me like the answer to prayer! So I went into TDD and CI head-first, and therefore it’s good for me to carefully read and understand that not everybody has the same experience.

I make TDD and CI a requirement of my teams, among other practices… and so an understanding of the struggles people can face is also important if we’re all going to produce and write great software together.

What was your experience embracing unit testing… more like Justin’s or more like mine? Have you tried TDD or CI (not just an automated build/test process)? What struggles have you had? How did you cope with them?

About ken
Creative insights, passion and technical adrenaline - strategist, agile coach and marketer, providing a good life for wife of 20 years & 2 awesome teenagers!

2 Responses to Who struggles embracing unit testing?

  1. aliciadudek says:

    Your link to “why bother unit testing?”, simply lead to the gif for me, not the blog?

%d bloggers like this: