Chapter 5

Driving Your Development with Tests

THIS CHAPTER INTRODUCES the programming concept of test driven development (TDD)—a style of development that enables you to focus on testing your application and ensuring it delivers the features and functionality that you set out to create. TDD gives you great confidence that each new piece of functionality you write in your code is backed by a test, which confirms how it behaves.

Test driven development is often a key part of the agile development process, which advocates iterative development over more restrictive processes such as waterfall. TDD in agile makes testing your focus up front, rather than an afterthought at the end of development. This chapter introduces you to the ideas and concepts of agile development. It also covers the basics of how you undertake TDD, where it fits into the agile process, and the advantages of working in this way. And finally, the chapter leads you through an example in a TDD manner.

Agile Development

Agile is a process that has become increasing popular in recent years, both in personal or smaller projects and within large business such as BSkyB, Facebook, Spotify, and Netflix, to name a few. But why are the big companies moving to such a process and what benefits does it bring? The main driver behind agile development is that it is an iterative process (usually in cycles of two to four weeks), with a working deliverable at the end of each iteration. A big plus point to this process is that it ...

Get Testing Python: Applying Unit Testing, TDD, BDD and Acceptance Testing 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.