[FRPythoneers] Doctest

Rob Riggs rob at pangalactic.org
Thu Jul 26 21:48:40 MDT 2001


Uche Ogbuji wrote:

>
>Our code *isn't* organized into classes and methods: we use the
>scripting approach rather than copying Java: personally, I think
>scripting makes much more sense than OO for testing.
>
That's an interesting statement. I'm not sure I understand it though. 
With PyUnit, one essentially "scripts" a set of test cases. Those test 
cases are member functions of a class. The OO is pretty much incidental. 
It's not necessary that it be OO, but the fact that it is does not get 
in the way.

>We basically set up helper functions for doing things such as comparing
>results, then the developer writes a straightforward script that
>executes the test case.  This script is run from another program which
>execfiles the script and captures all exceptions and regression failures
>for report.
>
PyUnit seems similar enough to me. But rather than stand-alone helper 
functions, PyUnit's helper functions are member functions in a test 
framework.

Honestly, your comments above seems like a lot of NIH syndrome. JUnit 
was developed by none other than Erich Gamma and Kent Beck -- a couple 
of folks that have had a little bit to say about software development in 
the last few years. PyUnit is a translation of their efforts. So, please 
excuse me if I'm not impressed by the complaints of a couple of my 
fellow Python afficianados. I'm sure your testing scripts work just 
fine. But I haven't understood any of the arguements against PyUnit yet. 
But, hey, to each his own.

I have found PyUnit to be flexible enough to meet all of my unit testing 
needs. I use it for testing all of my Python code. And we are even using 
it to unit test some really nasty PL/SQL stored procs (in preparation 
for later refactoring work). The framework has made setting up reliable 
and repeatable tests as simple as it can be made, IMHO.

It seems to me that the arguments I've seen put forth against PyUnit so 
far are based on misperseptions by people who have not used it 
extensively. PyUnit is such a simple framework that there really isn't 
anything to get in the way of doing whatever one wishes.

Maybe I've missed the whole point of this discussion... In the end, the 
fact that more people are actually writing automated unit tests (no 
matter what tool they use) is a step in the right direction.





More information about the FRPythoneers mailing list