Editorial Note: I originally wrote this post for the SubMain blog. You can check out the original here, at their site. While you’re there, have a look at CodeIt.Right.
For years, I can remember fighting the good fight for unit testing. When I started that fight, I understood a simple premise. We, as programmers, automate things. So, why not automate testing?
Of all things, a grad school course in software engineering introduced me to the concept back in 2005. It hooked me immediately, and I began applying the lessons to my work at the time. A few years and a new job later, I came to a group that had not yet discovered the wonders of automated testing. No worries, I figured, I can introduce the concept!
Except, it turns out that people stuck in their ways kind of like those ways. Imagine my surprise to discover that people turned up their nose at the practice. Over the course of time, I learned to plead my case, both in technical and business terms. But it often felt like wading upstream against a fast moving current.
Years later, I have fought that fight over and over again. In fact, I’ve produced training materials, courses, videos, blog posts, and books on the subject. I’ve brought people around to see the benefits and then subsequently realize those benefits following adoption. This has brought me satisfaction.
But I don’t do this in a vacuum. The industry as a whole has followed the same trajectory, using the same logic. I count myself just another advocate among a euphony of voices. And so our profession has generally come to accept unit testing as a vital tool.
Widespread Acceptance of Automated Regression Tests
In fact, I might go so far as to call acceptance and adoption quite widespread. This figure only increases if you include shops that totally mean to and will definitely get around to it like sometime in the next six months or something. In other words, if you count both shops that have adopted the practice and shops that feel as though they should, acceptance figures certainly span a plurality.
Major enterprises bring me in to help them teach their developers to do it. Still other companies consult and ask questions about it. Just about everyone wants to understand how to realize the unit testing value proposition of higher quality, more stability, and fewer bugs.
This takes a simple form. We talk about unit testing and other forms of testing, and sometimes this may blur the lines. But let’s get specific here. A holistic testing strategy includes tests at a variety of granularities. These comprise what some call “the test pyramid.” Unit tests address individual components (e.g. classes), while service tests drive at the way the components of your application work together. GUI tests, the least granular of all, exercise the whole thing.
Taken together, these comprise your regression test suite. It stands against the category of bugs known as “regressions,” or defects where something that used to work stops working. For a parallel example in the “real world” think of the warning lights on your car’s dashboard. “Low battery” light comes on because the battery, which used to work, has stopped working.