Understanding Python Unit Testing

It might seem strange that software developers still have trouble understanding. In this article, Jeff Knupp tries to describe what unit testing is, why it is useful and how you should perform unit testing for Python code.

Jeff Knupp starts by making a difference for his article between testing, which he considers as an automated task, and “manual testing” that he classifies in the debugging category. He also defines the “unit” as an isolated portion of code. Then he explains how to use unittest, the Python’s built-in unit testing framework. He then tries to answer the question “Why is testing a valuable use of my time?” and gives four reasons:
* Testing makes sure your code works properly under a given set of conditions
* Testing allows one to ensure that changes to the code did not break existing functionality
* Testing forces one to think about the code under unusual conditions, possibly revealing logical errors
* Good testing requires modular, decoupled code, which is a hallmark of good system design

Read the complete article on http://www.jeffknupp.com/blog/2013/12/09/improve-your-python-understanding-unit-testing/