Chapter 8. Test-Driven Development: Holding your code accountable
Sometimes it’s all about setting expectations. Good code needs to work, everyone knows that. But how do you know your code works? Even with unit testing, there are still parts of most code that go untested. But what if testing was a fundamental part of software development? What if you did everything with testing in mind? In this chapter, you’ll take what you know about version control, CI, and automated testing and tie it all together into an environment where you can feel confident about fixing bugs, refactoring, and even reimplementing parts of your system.
Test FIRST, not last
Instead of trying to retrofit testing onto an existing project, let’s look at a project from the ground up using a new technique, test-driven development, and write your code with testing in mind right from the start.
Starbuzz Coffee has been selling gift cards for several months, but now they need a way to accept those gift cards as payment for their drinks. Starbuzz already knows how their page should look, so your job is to focus on the design and implementation of the gift card ordering system itself.
So we’re going to test FIRST...
The Starbuzz ...
Get Head First Software Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.