There's more than one way to do things | |
PerlMonks |
Re: Fine line between integration testing and unit testingby kvale (Monsignor) |
on May 10, 2006 at 03:34 UTC ( [id://548374]=note: print w/replies, xml ) | Need Help?? |
In the decision between unit testing and integration testing, both is better :)
Unit testing usually refers to testing single functions or methods, while integration testing tests the compatibility among functions, methods, classes, components, etc. In practice, the distinction between unit and integration testing is blurry. For instance, a method may invoke private helper functions not accessible in the public API. So the distinction in between unit and integration testing is not as important as testing at all levels. Start with the smallest logical units of testing, such as functions or even assertions within functions. Then work your way up the chain as you write more code. In the context of your problem, it would make sense to mock the return value at first to test the business entities alone. Then test the data access modules with DBD::Mock, and then perform integration testing between the business entity and data access modules. -Mark
In Section
Seekers of Perl Wisdom
|
|