Unit testing provides the fastest quality feedback, allows refactoring by preventing regressions, and improves code design. Tests should be written for individual code units using test-driven development, testing during development, and having a comprehensive test suite. Tests help document code behavior and structure and should outnumber lines of code at a ratio of 3:1.