Course overview

What?

Test-Driven Development (TDD) is an iterative programming technique where you first write a failing test, which describes what you want to achieve, and after that write production code to pass the test. The code is continually refactored to make the next change easier.

This course should help you get over the initial hurdle of getting started with TDD. After that you'll likely still make changes in too big steps and your tests could be better, but at least you're writing them. Getting good at TDD will require further 6-12 months of deliberate practice.

Why?

TDD saves time.

First of all, you'll waste no time finding out whether your code works, since the computer will check it for you in under a second. Since you'll be running your tests many times per minute, you'll find out immediately if your change broke something. You won't waste time debugging, because it will be faster to undo your most recent change and try again.

TDD also works as a feedback mechanism, to find out sooner if the design you've chosen inhibits change. Then you can evaluate other designs, until you find one that lets you keep making changes quickly in the long run. Produce better software faster.

TDD Outcomes lists some things that you can expect from using TDD.

How Test-Driven Development Works (And More!) gives a more theoretical explanation on why TDD works than just "it works for me".

If you'd like to read academic papers, there's the 2020 research paper on Why Research on Test-Driven Development is Inconclusive? (TLDR: most test subjects have <1 year experience).

Who?

You are ready for this course if you have written at least a few small applications of over 1000 lines of code.

The basic version of this course (4 cr) requires good JavaScript and object-oriented programming skills.

The extended version of this course (4+1 cr) requires additionally some web development and database experience: you will need to implement a small full-stack web app. Relevant courses to that end are Full Stack Open (parts 0-5), DevOps with Docker (parts 0-2), Introduction to Databases (Finnish only) or any SQL tutorial.

How?

This course consists of six exercises (or small projects) about using TDD, refactoring and writing tests. Exercise 5 (full-stack web app) is optional, but if you do it, you will get an extra study credit. For that purpose, this course is visible as two course units:

The exercises are in JavaScript, but for the exercises where you create a project from scratch, you may use any programming language of your choice. To do the basic exercises, you'll need Node.js, Git and an IDE or text editor (e.g. IntelliJ IDEA or VS Code). For the full-stack exercise, Docker would be useful. To submit the completed exercises, you'll need a GitHub account and a screen recording software (e.g. OBS Studio).

When?

This course will run from January until May 2024 (and presumably next year around the same time). There will be a Discord channel and study groups. See the practicalities page for details.

Of course, you can also use this course material for self-study whenever you want, even if the course is not active.


Proceed to Practicalities or Exercises