There seem to be lot of confusion around Unit Testing Vs Integration Testing. So I thought, I should be writing something about it, to clarify on it:
The main purpose of unit testing is testing the smallest part of logical unit or behavior of the system. Logical unit can extend to single method to entire class or collaboration of multiple classes.
the idea of integration testing is to test the larger piece of module to make sure that combination of all units works together, so Integration test identify the problem when units are combined.
Let me give you a simple example, which would be easier to related with above definitions:
Let’s say you want to test the calculator, so if you test sum, multiply, etc functions individually of it then we can call it Unit Testing and when you are try to combine different behavior of calculator where multiple classes are involved like adding and multiplying two numbers and subtracting with some other number called the Integration Testing.