Some “Best Practices” on Unit Testing

This section lists some effectice tips on how to make effective use of Unit tests in common development situations on Lire.

Changing interface/implementation. Before changing a module interface or implementation, make sure that this module has test cases and that it passes its tests before changing the implementation. This way you can know that you changes didn't break anything.

Debugging. A good opportunity for writing tests is when bug are reported. Before trying to chase the bug using the debugger or adding print statement, write a test case that will fail as long as th bug isn't fixed. This achieves two purpose: first, you'll know when the bug is fixed as soon as the test pass; secondly, we now have a test case that will warn us if we regress and the bug reappears.