[FRPythoneers] Doctest

Uche Ogbuji uche.ogbuji at fourthought.com
Thu Jul 26 07:09:20 MDT 2001


Steve Purcell wrote:
> 
> Uche Ogbuji wrote:
> > 4Suite has almost 600 test files, making up over 2000 test cases.  It is
> > very rare that it can get through *all* of them without incident.  Often
> > we'll have to tolerate a particular failure in a process of triage.
> 
> Hi Uche,
> 
> If I write the following test methods:
> 
>     class MyTestCase(unittest.TestCase):
>         def testSomething(self):
>             # might fail
>         def testSomethingElse(self):
>             # might also fail
>         def testYetAnotherThing(self):
>             # potential problems here too
> 
> then run them in the usual way wrapped up in a TestSuite (e.g. with
> unittest.main()) all the test cases (ie. test methods) will be run, and
> the results reported at the end. This holds even if some of those test
> cases fail.
> 
> That already sounds like the behaviour you want.

Perhaps somewhat.

But I need this continuation to be in effect over test cases in hundreds
of files.

> What am I missing?

Perhaps nothing.

> (Individual test case instances, when they run their particular test
> method, must work independently of any other test cases that might be run
> at the same time -- this is the usual XUnit premise)

This isn't a problem.

> > We've been mulling over porting to PyUnit, but I fear it's a non-starter
> > if it won't let us continue on failure of a test case.
> 
> Perhaps you can describe how your test code is organised into TestCase
> subclasses and test methods so I can see what you mean.

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.

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.

It's all there in 4Suite (http://4Suite.org).


-- 
Uche Ogbuji                               Principal Consultant
uche.ogbuji at fourthought.com               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Boulder, CO 80301-2537, USA
XML strategy, XML tools (http://4Suite.org), knowledge management



More information about the FRPythoneers mailing list