UNIT TESTING - This month, we’ll be discussing a technique that’s complementary to Design by Contract -- unit testing, a way of automatically checking that methods are doing the right thing and, more importantly, do not “break” when you make changes to your program. In DbC, we individually examined both the preconditions and postconditions of methods. Unit testing is the inclusion in a project of extra test methods that check that the logic within each program method is correct and the method performs the calculations it is expected to do correctly. This allows you to experiment more with program design, improve your program design over time through refactoring, or maintain a program after it’s been released, all without without worrying about screwing up (that’s a technical term, you know) your program in the process. Without unit testing, it would be too easy to miss subtle mistakes as you rework your code, leading to difficult to find bugs, or you might just give up and avoid making changes. With unit testing, you know that the method works and can check that it keeps on working.