Getting Started with Unit Testing
unit-testing
Solution
Ok here's some best practices from some one who doesn't unit test as much as he should...cough.
- Make sure your tests test one thing and one thing only.
- Write unit tests as you go. Preferably before you write the code you are testing against.
- Do not unit test the GUI.
- Separate your concerns.
- Minimise the dependencies of your tests.
- Mock behviour with mocks.
Problem
Unit testing is, roughly speaking, testing bits of your code in isolation with test code. The immediate advantages that come to mind are: - Running the tests becomes automate-able and repeatable - You can test at a much more granular level than point-and-click testing via a GUI Rytmis My question is, what are the current "best practices" in terms of tools as well as when and where to use unit testing as part of your daily coding? Lets try to be somewhat language agnostic and cover all the bases.