Test Driven Development (TDD)

General information about best practices

Test-Driven Development, TDD, refers to a development practice where you follow a cycle of four stages. (It is usually presented as the last three, i.e. red-green-refactor, but this leaves out perhaps the most important step.)

There is much more that can be said about TDD than what is contained in this brief summary. Consider this page just a starting point for your learning, not a complete list of everything you need to know.

Kinds of testing

There are a wide variety of kinds of tests, including unit tests, functional tests, integration tests, end-to-end tests, regression tests, and others. We’ll focus mainly on unit tests in this course, though we will discuss some of the other kinds of testing.

Unit testing tries to focus on a single unit of code, e.g. a single constructor or method, ideally isolating the testing of that unit from all other dependencies.

JUnit: a Java Library for TDD

The most widely used and influential TDD library is JUnit, originally developed by Kent Beck for doing TDD in Java programming. JUnit has served as a model for unit testing libraries for many other programming languages.

References on TDD