Intro to test-driven development (TDD)

It is important to ensure a level of confidence that your programs work as intended, that is, correctly. One way to do it is by formally proving correctness which is an interesting subject in pure science that will not be covered here.

Another way is by writing tests. You write tests and assertions describing how your program should behave, basically what the expected output is given a specific input, and then let the test suite automatically run the tests on your code. If any errors are found (e.g. one of the tests doesn’t pass), then you can assume that either your program’s algorithm or the test is wrong.

This is called test-driven development.

Having a set of tests also helps in further development of your program, e.g. by having your code tested after every major code change, you ensure that you don’t accidentally break any of the existing program features with the new code you’ve commited.

Task

This repository contains a taste of what TDD is like in the real world (in either Python, Ruby, JavaScript, …). The code also adheres to object-oriented programming principles. What can you do with it?

Python

You will learn to appreciate The Zen of Python through solving simple Python problems.

Your task will be to write not the program but the tests for it.

This will provide a good introduction, or will deepen what you already know about the Python language and designing computer software in general.

Follow the instructions here: Python koans

Ruby

You can also test/expand your knowledge of Ruby with Ruby koans (like Python koans above, just a little uglier).