IBM developerWorks: Python 101: Testing your code, Discover PythonUnit, a Unit Testing Framework

“New developerWorks columnist Evelyn Mitchell follows up her
first Python article, which introduced you to the Python
programming language. In this installment, Evelyn explains the
virtues of unit testing as you write a program, and looks at
PythonUnit, a testing tool, using some short sample programs to
illustrate the tool and further expose you to programming with

“Unit testing is the process of testing code as you write it.
You can also use unit testing during regression testing, in which
you determine if a program is working the way it did before you
modified it. Unit testing is also known as “white box” or “glass
box testing,” as opposed to “black box testing.”

“Black box testing is, roughly speaking, testing done by someone
who does not have access to the program’s code. In black box
testing the program is viewed (you might have guessed) as a black
box that takes inputs and produces outputs, but doesn’t reveal its
internal structure. By contrast, unit testing exercises your full
knowledge of the code by testing the interfaces to other code
components and to user space, as well as the implementation.”