Print Page | Close Window

Separation of Interface from Implementation

Printed From: One Stop Testing
Category: Types Of Software Testing @ OneStopTesting
Forum Name: Unit Testing @ OneStopTesting
Forum Discription: Discuss All that is need to be known about Unit Software Testing and its Tools.
URL: http://forum.onestoptesting.com/forum_posts.asp?TID=454
Printed Date: 24Dec2024 at 7:10am


Topic: Separation of Interface from Implementation
Posted By: sunita
Subject: Separation of Interface from Implementation
Date Posted: 02Apr2007 at 4:25am
Because some classes may have references to other classes, testing a class can frequently spill over into testing another class. A common example of this is classes that depend on a database; in order to test the class, the tester finds herself writing code that interacts with the database. This is a mistake, because a unit test should never go outside of its own class boundary. As a result, the software developer abstracts an interface around the database connection, and then implements that interface with their own Mock Object. This results in loosely coupled code, thus minimizing dependencies in the http://onestoptesting.com/types/Unit.asp# -



Print Page | Close Window