automated test

A small program that runs part of your code and checks that it did what you claimed it would.

In more detail

A test is a claim about behaviour written as code, so a machine can check it again on every change without getting tired. It buys you permission to change code safely. It also costs something: it is code that has to be read, kept passing and updated when the behaviour changes on purpose.

Example

def test_two_lines_add_up():
    assert total([(250, 2), (125, 4)]) == 1000

Related terms

Taught in

References