Unit Testing is a level of software testing where individual units/ components of a software are tested. The purpose is to validate that each unit of the software performs as designed. A unit is the smallest testable part of any software. It usually has one or a few inputs and usually a single output.
Unit Testing is the first level of software testing. It is normally performed by software developers themselves or their peers.
Unit Testing -> Integration Testing -> System Testing -> User Acceptance Testing
Unit testing increases confidence in changing/ maintaining code. If good unit tests are written and if they are run every time any code is changed, we will be able to promptly catch any defects introduced due to the change.
Isolate the development environment from the test environment.
Use test data that is close to that of production.