Creating module skeleton from unit tests

Peter Maas peter at somewhere.com
Fri Mar 4 02:42:40 EST 2005


Edvard Majakari schrieb:
> Greetings, fellow Pythonistas!
> 
> I'm about to create three modules. As an avid TDD fan I'd like to create
> typical 'use-cases' for each of these modules. One of them is rather large,
> and I wondered if it would be easy enough to create a code skeleton out of
> unit test module.

I think this is too difficult, because there are many ways to write
code (even skeletons) for a use case. An easier approach would
be to write the skeleton manually, embed the test cases in the doc
strings and generate the test code from the doc strings. If I
remember correctly IBM has published something to generate unit
tests from code. Python has a doctest module to support testing
derived from doc strings. This can be combined with unit tests.

 > The problem can be solved more easily if you design the module
> skeleton first, then the tests and then the logic for the skeleton
> - you would be creating tests before the code, but many people
 > wouldn't regard it as TDD then.

You shouldn't care if your approach works for you.

-- 
-------------------------------------------------------------------
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------



More information about the Python-list mailing list