I see the following clear benefits of tests among many.
- If your working code is the truth, tests are the validators of that truth. Tests are the code's knowledge base.
- They take out the fear of unknown. This encourage the developers to refactor the code and improve it instead of merely maitaining it.
- Tests essentially improve the design of the code
- Tests helps new developers to come up to speed with the code base quickly
TestDriven.Net is a visual studio plugin that makes it super easy to run the tests right from the IDE. This plugin integrates well with NUnit GUI and also NCover.
NCover is a code coverage tool. It shows how much of your source code is covered by the tests. Once you run the tests using NCover, it produces a report of which parts of the source code is not covered by the tests in percentages.
I found that these numbers play an important role in the developer psyche. Once developers looks at these numbers, and know that how much of their code is not being tested at all, they can't resist from writing more tests. I have seen this happening all the time. If stackoverflow.com's success is any proof that developers like numbers, scores, this makes complete sense.
Declare a target coverage percentage to the team and announce which parts of the code reached the target in the daily team meetings. Like every other thing in development large number of poorly written tests could become a maintenance headache. Once your team gets in to the track of writing tests, it is very important to review the tests.
Happy testing!
No comments:
Post a Comment