Subject: Proposed Tutorial: Unit Testing and Refactoring
From: Joel Shprentz <jshprentz@his.com>
To: ipc8-tut@python.org
Date: Thu, 30 Sep 1999 14:39:15 -0400
X-Accept-Language: en

Unit Testing and Refactoring: Extreme Programming Techniques for Python

Instructor:
Joel Shprentz, Synthetic System Specialist, TRW


This tutorial will show how to apply two Extreme Programming practices to
Python code.

Unit tests are tests of individual Python classes.  Programmers write tests
for everything that could conceivably not work.  In Extreme Programming,
unit tests are written before new application code.  Tests are run after
every code change.  When the tests all pass, the code is done.  This
tutorial will demonstrate a testing framework, PythonUnit, which provides
common testing services and test management.

Refactoring is the process of rearranging an object design to improve its
internal structure without changing its external behavior.  Refactoring can
result in reduced duplication, greater simplicity, easier reading, and
better performance.  Unit tests are run before, during, and after
refactoring to minimize the chance of introducing new bugs.  This tutorial
will demonstrate many of more than 70 cataloged refactorings.

Ron Jeffries describes Extreme Programming as "a humanistic discipline of
software development, based on principles of simplicity, communication,
feedback, and courage."  This tutorial will summarize Extreme Programming
to provide a context for better understanding unit tests and refactoring.


Reference Books:
"Extreme Programming Explained: Embrace Change" by Kent Beck
"Refactoring: Improving the Design of Existing Code" by Martin Fowler

Reference Web Sites:
http://www.xProgramming.com
http://c2.com/cgi-bin/wiki?ExtremeProgrammingRoadmap


Unit Testing Example - 30 minutes
- Introduction
- Example Application Described
- Test Cases Written and Run
- Application Code Written and Tested
- Development and Testing Continues

PythonUnit:  Unit Testing Framework - 45 minutes
- PythonUnit Package
- Test Cases and Suites
- Running Tests
- Fixtures: Setup and Tear Down
- Common Tests
- Organizing Tests
- Tracking Tests Over Time

Refactoring Example - 30 minutes
- Example Application Described
- Bad Smell in Code
- Code Refactored and Tested
- Refactoring Continues
- New Functionality Added and Tested
- Refactoring Continues

Refactoring Python Code - 45 minutes
- Refactoring Defined
- Why Refactor
- Catalog of Refactorings
- Python Issues

Extreme Programming - 45 minutes
- What is Extreme Programming
- Project Life Cycle
- Development Iteration Cycle
- Role of Unit Testing and Refactoring
- Resources and Community


--
Joel Shprentz              (703) 478-9668
1516 Park Glen Court       jshprentz@his.com
Reston, VA 20190