20 Sept 2004

Refactoring Unit Tests

I'm currently refactoring some of my unit tests I made when I first started using JUnit framework.

2 things stroke me at first sight:
  • I make better unit tests now:
    1. I test only usefull thing,
    2. they depend less upon other things (ex: a file present in file system)
    3. they are clearer
  • Using Unit tests forced me to create new entries in my legacy classes, now unit testing is easier. I don't have to refactor a class before starting to unit test it.

No comments: