1 The basics of unit testing


This chapter covers

  • Identifying entry points and exit points
  • The definitions of unit test and unit of work
  • The difference between unit testing and integration testing
  • A simple example of unit testing
  • Understanding test-driven development

Manual tests suck. You write your code, you run it in the debugger, you hit all the right keys in your app to get things just right, and then you repeat all this the next time you write new code. And you have to remember to check all the other code that might have been affected by the new code. More manual work. Great.

1.1 The first step

1.2 Defining unit testing, step by step

1.3 Entry points and exit points

1.4 Exit point types

1.5 Different exit points, different techniques

1.6 A test from scratch

1.7 Characteristics of a good unit test

1.7.1 What is a good unit test?

1.7.2 A unit test checklist

1.8 Integration tests

1.9 Finalizing our definition

1.10 Test-driven development

1.10.1 TDD: Not a substitute for good unit tests

1.10.2 Three core skills needed for successful TDD