Some “Best Practices” on Unit Testing
Prev | Chapter 16. Making Lire “Test-infected” | Next

## Some “Best Practices” on Unit Testing

This section lists some 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 your changes didn't break anything.

Debugging. A good opportunity for writing tests is when bugs are reported. Before trying to chase the bug using the debugger or adding `print` statements, write a test case that will fail as long as the 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.

Prev | Up | Next
Running Tests | Home | Chapter 17. Commit Policy