[Tutor] designing POOP

Kent Johnson kent37 at tds.net
Thu Feb 7 23:20:17 CET 2008


bhaaluu wrote:
> What is the equivalent of JUnit in Python? 

The unittest module is based on JUnit.
http://docs.python.org/lib/module-unittest.html

Here is a simple introduction to the capabilities of unittest. It 
doesn't do much to motivate the examples though:
http://www.oreillynet.com/onlamp/blog/2007/09/pymotw_unittest.html

A longer intro:
http://agiletesting.blogspot.com/2005/01/python-unit-testing-part-1-unittest.html

An alternative to unittest is doctest. They both get the job done, which 
one to use is mostly a matter of preference and the complexity of the tests.
http://docs.python.org/lib/module-doctest.html

Wikipedia has a short introduction to doctest and a link to Tim Peter's 
c.l.py posting introducing the module:
http://en.wikipedia.org/wiki/Doctest
http://groups.google.com/group/comp.lang.python/msg/1c57cfb7b3772763

Another intro:
http://agiletesting.blogspot.com/2005/01/python-unit-testing-part-2-doctest.html

There are many other testing tools that are not in the standard library. 
Nose and py.test are popular alternatives to unittest and doctest.
http://agiletesting.blogspot.com/2005/01/python-unit-testing-part-3-pytest-tool.html

Here is a good list of testing articles:
http://www.pycheesecake.org/wiki/AgileTestingArticlesAndTutorials

Here is a pretty comprehensive list of tools:
http://pycheesecake.org/wiki/PythonTestingToolsTaxonomy

Kent


More information about the Tutor mailing list