[Erp5-dev] testing framework

Jerome Perrin jerome at nexedi.com
Tue Aug 1 00:35:35 CEST 2006


On Mon, Jul 31, 2006 at 07:34:29PM +0200, Bartek Gorny wrote:
> Hello
> 
> I tried to write and run a unit test for ERP5, and it doesn't seem to
> work as expected. The question is, what am I doing wrong?
> 
> Here is what I've done: I followed an example of testAccounting.py,
> removed everything except getBusinessTemplateList and added one dummy
> test function. That's all.
> 
> I placed the test and two files (framework.py and runUnitTest.py) in a
> /test subdirectory, and run it with a command "./runUnitTest.py
> testMyClasses".

This is not necessary, runUnitTest will try to import your class from
Products/*/tests/ directories, thus :
$INSTANCE_HOME/Products/ERP5Type/tests/runUnitTest.py testMyClasses
is enough.
 
> The problem is that the logs say that all products and business
> templates are sucessfully installed, then a site with an id like
> erp5_portal_dd9a9b9b5ad09b83394306ac1ff29294 is created, and then
> ActivityTool starts throwing exceptions "KeyError:
> 'erp5_portal_dd9a9b9b5ad09b83394306ac1ff29294'", and then, because
> activities do not get off the queue, the test throws RuntimeError "tic
> is looping forever".

During the setUp step, an ERP5 Site is added in the test storage, then
some business templates are installed ( from getBusinessTemplateList )
but if something goes wrong during BT installation, a traceback is
printed on stdout, and execution continues; (probably this test should
just fail at this point, it's a current weakness of the framework).

So, for now, check carefully what happens during setUpERP5Site from
ERP5TypeTestCase. Some configuration mistakes in business template can
prevent a bt5 from being installed on an empty site (missing
dependencies: workflows, portal types ...)

 Jerome




More information about the Erp5-dev mailing list