Reading List

Wednesday, March 20, 2013

Unit Testing on a tight Project Schedule

In our projects, we are always pressed for time to deliver. Usually, this pushes writing unit tests to be a lower priority. In their book, Pragmatic Unit Testing In C# with NUnit, Andrew Hunt and David Thomas give general principles on what to test. One principle is to test anything that could break. Prioritizing what gets unit tested is important when time is limited. Methods that can break, are complex, and important to the project should be picked as candidates to have unit tests. Another principal that can fit into a project with a tight deadline is to write unit tests for anything that does break. If unit testing is not part of the project plan, then testing anything that breaks could be a way to increase code coverage. This way of writing unit tests is not optimal as the rules for how the method should work has to be reviewed again. Additionally, the risk for completely skipping unit testing during bug fixes is high so this will take discipline from the project team to follow through. This, in turn, opens up the opportunity to prove to the client that unit tests are worth including in the project plan. Leave a comment if you have a tip on writing unit tests for a project with a tight deadline or introducing unit test to an existing project?