9. February 2013 17:01
Unit testing ensures that specific methods perform as expected and returns the expected output on various input conditions.
Unit tests makes the life of software developers easy and comfortable since code refactoring and optimizations are inevitable part of software system life cycle.
Properly written unit tests with 100% coverage gives the developer an absolute freedom to refactor his code at later stage and executes the unit tests again to confirm the code change not impacted the method functioning.
For properly unit testing a method it is mandatory that the method should have a non void return type.
Application best designed with loose coupling and high cohesion in mind are a better candidate for unit testing with good coverage.