Unit testing, mock-ups and proxies
Keeping check on your code's behavior

Unit tests are used to test the semantics of your code; To verify it works as expected and keeps working as expected through changes.

Unit tests are light-weight and fast. Don’t get tangled up in hard-to-handle dependencies such as loading databases or instantiating long sequences of objects before you get to the actual testing, use mock-ups and stubs to simulate your first order dependencies.
A unit test is ideally quick to execute and it should be executable in the context of your development environment.