I am sure you have heard about this if you have done unit tests before or you have experience in software development project that employs the TDD (Test Driven Development) approach.What actually is a mock object? An object that mimics the behavior of real object in a controlled way. Mock objects are often used in unit test to simulate the behaviors of the dependencies for the object being tested. Mock objects are used because in real life the real objects are very impractical or impossible to create in the unit test environment. It is impractical and impossible because configuring and setting up all these real dependencies subjected to budgets, time or unavailability of the real dependencies at the time the unit testing is performed. For e.g. to unit test an object that uses a database, you can easily setup up a SQL Server database connection with the Visual Studio and it is fairly simple and manageable task. What if the objects you need to test also depend on other data source that resides on the mainframe server in a secure environment or other third-party library that is still under development? Let assume all the constraints to set up and configure the real dependencies for the objects to be tested don’t exist, then the unit tests themselves will look like the integration tests. This will defeat the purpose of unit testing as the unit test is to isolate each part of the program and to ensure each of this individual parts meet its design and behaves as intended. It meant to be simplest, fast and exercise very specific functionality. The setting up and configuration of the real dependencies for the objects being tested should be deferred until the integration testing where the idea is to test the combination of units and to identify problems that occur when units are combined. It will eventually expand to testing the modules with those of other groups and finally all the modules that make up the process are tested together. It is significant slower than the unit testing. Read more: KITCHAIYONG.NET