Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You’ve now seen what we’re trying to achieve by testing software, and how test-driven software and unit tests can help to achieve that. But how exactly is a unit test written? In this chapter you’ll see a single unit test being built from first principles. You’ll see what the different components of a test are, and how to go from a test or collection of tests to production code. The code in this chapter is not part of a project: It just shows the thought process in going from requirement to tested app code. You do not need to run the code in this chapter.