What a Project Manager would like to know about unit testing

Which is the most pragmatic approach to introduce automated unit testing to project managers ? In this article I describe you what are the questions made by a PM I worked with about automated unit testing.

The story

I just completes what could be called a small one man project, a java based reporter web application. During the development I had to report my progresses to a project manager, that kept the communication with our final customer. The PM gave me an high degree of freedom about the software architecture, usually trusting the choices I made after I explained them.
I made use of JUnit test in the project, both for unit and integration tests. I also had a test database and I used DbUnit to set the test data on the db before running the tests. The build process embedded the execution of tests to avoid build anything if a test was not passing. Thus I had a quite common set up.
I told my PM about the use of automated tests from the early stages and we kept on discussing about them even though I often explained him how I was using the automated test during the development and in the building process.

My opinion

During the development I had the feeling the PM of this story was both interested and scared about automated testing.
In one hand he was undoubtedly interested because:
  • he kept on asking me every now and then information about the test automation;
  • he’s very curious kind of person and he was always listening to what the developer community is buzzing about.
In the other hand he was scared because:
  • as a PM he needs to manage strictly set budgets and he was not really aware (and probably he is still not) of the costs and advantages of automated unit testing;
  • he wrote a line of code for the last time quite a long time ago, and almost its whole experience was with procedural languages, so he was not totally accustomed with polymorphism in object oriented languages, a feature that definitely helps in writing unit test;
  • he was almost obsessed by how apply unit testing to database and data driven application, since these are the application he is accustomed to;

What can be deduced ?

Things a PM should already know about unit testing

  • IT people seems to know that unit testing exists and they know developers generally say they help build better applications.

Things a PM would like to know about unit testing

Here’s the list of main questions I collected from the PM. I think they are quite representative of the doubts a PM has about unit testing, and so they represent a good starting point to organize an educational and introductory session to them.

Q: how much does it cost do develop a project using unit test ?

How to answer: I think the first concept that needs to be made clear is how much does it cost to use unit testing in a project. Does unit testing make the process cheaper or more expensive ? Faster or slower ? As usually, it’s all related to money from a PM’s point of view. A good resource could be an analysis that compares different projects that made different use of unit testing.

Q: how much is the foreseen gain in quality ?

How to answer: I think it would be good to show some statistics that compare data collected from projects that made use of unit testing with ones that did not. Again, the same resources that made possible an answer to the previous question could be successfully used to answer to tis question too.

Q: can unit test be applied to the application of data driven development ?

How to answer: In some consultancy sectors, data driven application are the most important. So if you think to introduce testing, you have to do it also for the data layer, if you want your PM to be interested in unit testing. If you are working in Java I think DbUnit could be a good starting point.

Q: how it is really possible to isolate a piece of code, a class, and run it in a dedicated test environment, to test it ? What really are the benefit of it ?

How to answer: I think here we need the smallest possible project that can quickly show:
  • Developing a class with test.
  • How to set a test of a class that has dependencies on other classes.
  • How tests of a couple of integrated classed.
  • How unit test classes with dependecies on other external app.
  • Show a real case in which a test suite pop up a regression bug.

I hope this would be a good guide about how to introduce your PM to unit testing.