Part of the afternoon talk was on unit testing. There was a lot of material covered, so here are just a few topics discussed.
- Always remember that when you are adding unit tests you are adding more code that will now need to be maintained. Writing difficult to understand or brittle unit tests will cause future maintenance problems.
- Unit tests must be highly readable so that they will be easier for developers to understand in the future as they are also a form of documentation. Reading existing unit tests are also a great way for a developer to quickly understand how an existing class is supposed to be used.
- Never have a conditional or loop in a unit test, if you do, you must rewrite the test.
- Unit tests should always be simple.
- Unit tests are extremely important. TDD is important, but if there is an area of an application that is not currently covered by unit tests there is still a great deal of value in adding unit tests to these areas of the application