Series Navigation
Part 1: Introduction
Part 2: Getting Started
Part 3: Social Unit Tests
Part 4: Heart Container Implementation
Part 5: Test Data Builders
Part 6: Safe Refactoring
Part 7: Basic Player Health
Part 8: An Event Driven UI
tl;dr – Unit testing business logic builds confidence in your code, fosters change, and supplies a way to passively create documentation.
When you first start unit testing you want to write tests for everything. New applications are easy because you can simply perform test driven development to guide the process. But writing a test suite for a legacy application can be pretty daunting.
TL;DR – Writing maintainable unit tests starts with treating test code differently than your production code.
In my experience introducing unit tests to a project can come with its fair share of resistance. An argument I hear often is that test suites rarely provide an acceptable return on interest; the cost of maintenance is just too high.