Chapter    6

Test-Driven Development

It wouldn’t be right if we didn’t make an effort to show test-driven development (TDD) in action. So, in this chapter we’re going to create an app from scratch using our TDD approach. Using TDD, we’re going to create a sample app for a daily horoscope. I’m not an astrology fanatic by any means, but it’s a simple enough app that will allow us to show our TDD techniques in action.

Understanding Test-Driven Development

TDD means that we take the first feature on our list of features and code using the following process:

  • Write a test first and see it fail (red)
  • Implement the simplest possible solution to get our test to pass (green)
  • Refactor to remove any code smells (refactor)

In reality you’re probably going ...

Get Agile Android 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.