Articles

On unit testing

In Product Development, Uncategorized on April 28, 2010 by petrem66

I think it will take a how lot of time to do proper unit testing. It is like coding twice as much as it should be. The benefit though it is that one can verify a lot faster that modules behave as expected. There are some very good points about unit testing at writing-great-unit-tests-best-and-worst-practises
The big question still remains about how granular the testing should go. There are two main ‘camps’ of unit testing supporters that I know of.
People in the first camp believe that the best results are to be obtained when unit testing at component level, such as at class level. One should not leave out any visible functionality of it, and with the unit test both negative and positive use cases are to be covered. I have an issue with this approach in that with growing code, and an evolving product it is very hard to maintain the integrity of the unit tests. The second camp, align the unit testing to the structure of the application, that is, unit test can follow the lines of delimitation between modules seen as a unit. Remember some design patterns like the session facade, people in the second camp won’t bother testing such a class since it merely pass on requests to other classes. Further, when you use dependency injection with Spring Framework, the module unit testing becomes the only logical choice

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: