Search The Blog
Latest Posts
Twitter: @RoyOsherove
About this site

TDD in .NET Online Course

TDD and BDD in Ruby Online Course



This site aims to connect all the dots of my online activities - from tools, books blogs and twitter accounts, to upcoming conferences, engagements and user group talks.

« Itamar at 1.5 | Main | Making Tab mix plus and other firefox addons work with Firefox 3 beta »

Unit testing vs. Integration Testing : The Restaurant Analogy

Here's an analogy I came up with to explain the difference between unit tests and integration tests.

Imagine going to a restaurant with a bunch of your friends. there are some couples there as well as singles. At the end of the meal, it is time to pay. Unit testing is like giving a separate bill to each couple or single. Each person knows only what they needs to pay as well as tip, but do not care what anyone else had, or what the total meal amount is. as long as they pay what they need, they can go home peacefully.

Integration testing is like giving one big check to the group, with everyone having to calculate on their own how much they need to pay. sometimes everyone things they are good, but in the end the total amount may be too high or too low. There is a lot of interaction going on to decide who pays for what and who has already paid.

PrintView Printer Friendly Version

Reader Comments (2)


January 27, 2011 | Unregistered Commentermeh

I like the analogy. It's simple and it works. As with most analogies, it breaks down if you take it much further. Thanks!

February 17, 2011 | Unregistered Commenterbynary

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Web Analytics