Unit Testing vs Functional Testing : An anology

Many times, development of the system is similar to building a house. Though this analogy is not very accurate, you can extend it to understand the difference between unit tests and functional tests.

Unit testing is similar to a building inspector visiting the construction site of the building. He/She focuses on various house elements such as internal systems, foundations, frames, electricity, plumbing, etc.. He certifies (after testing) that the parts of the house, work correctly and safely, that is, they meet building standards.

Functional testing in this scenario is similar to a homeowner who visited the same construction site. He/She assumes that all the internal systems work properly and the building inspector is performing his work. However, the homeowner focuses more on the quality experience and emotions of living in this house. He/She is interested in how the house looks, whether the various rooms are comfortable sizes, whether they fit the family’s needs, and whether there are windows in good places for ambient natural lighting.

The Homeowner is indirectly doing functional testing of the house. He/She has a user’s point of view.

The Building inspector, on the other hand, is indirectly doing unit tests of the home. He has a developer’s or architect ‘s point of view.

Unit tests are written from the perspective of the programmer. Ensure that certain methods (or units) of the class perform a series of specific tasks.

Functional tests are written from the user’s point of view. They guarantee that the system is functioning as the user expects.

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s