[TIP] Beginner Resources

Nate Lowrie solodex2151 at gmail.com
Mon Mar 5 16:00:54 PST 2007

On 3/5/07, Julius Lucks <lucks at fas.harvard.edu> wrote:
> Hi all,
> Are there any good resources for someone who is a beginner to test-driven
> development.  I have read just a few articles including a chapter in Dive
> Into Python
> (http://diveintopython.org/unit_testing/index.html), and
> one on O'reilly's Python Dev Center site
> (http://www.onlamp.com/pub/a/python/2004/12/02/tdd_pyunit.html).
> I could follow each of those articles, but was still struggling when trying
> to apply some of those same principles to my code, which mainly deals with
> scientific programming and bioinformatics.

Ok, let me start off and say congrats for becoming a TDD convert.
Next, your first order of business is NOT to try to add tests to your
existing code.  I say that because this is one of the hardest things
to do and as a beginner you will probably frustrate yourself to no end
(I am currently and I have done several TDD projects).

When we started learning a language, we wrote a whole bunch of sample
programs right?  Well, same concept here.  That roman numeral example
in DIP was fairly simple right?

A couple of examples to do could be area, volume, density, converting
a hex string into a rgb color tuple and vice versa, implementing an
unbounded stack class, and implementing a product order class.

Those should be done with state verification only.  Write tests for
happy paths and error paths.  Basically the same stuff in the DIP
roman numeral example.  Basically, start to get into a mindset of
writing tests before code.

I would strongly recommend reading everything on
http://xunitpatterns.com/  It goes into in depth detail on the
different aspects of TDD, test smell, code smells, refactoring, etc.

Other articles I've found useful are:





A slew of articles at http://www.xprogramming.com/


I hope this helps.

> I would love to know of more in-depth sources that cover the different types
> of tests (functional, unit, document, ...), and that also cover good coding
> practices to use them effectively.
> I appreciate your help,
> Julius
> -----------------------------------------------------
> http://openwetware.org/wiki/User:Lucks
> -----------------------------------------------------
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python

More information about the testing-in-python mailing list