Literate Testing: Automated Testing with doctest Jim Fulton, jim@zope.com Tim Peters, tim@zope.com PyCon 2004

Unit testing

Why automated testing?

Testing is meta programming

unittest (aka PyUnit)

widget.py

Sample: widgettests.py (part 1)

Sample: widgettests.py (part 2)

Test output:

Test runner: alltests.py

unittest problems

doctest origin - docs

doctest origin – interactive testing

doctest origin – put tests in the docs

widget2.py (part 1)

widget2.py (part 2)

Integration of doctest and unittest

So what changed?

Where do tests go?

Telling stories with tests

doctest pitfalls

doctest pitfalls (continued)

Automated testing in Zope

Future doctest directions