Commit 0f879036 authored by Jérome Perrin's avatar Jérome Perrin

tests the performance of a form with proxy fields


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20136 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6c6b6a96
...@@ -30,6 +30,7 @@ import unittest ...@@ -30,6 +30,7 @@ import unittest
from time import time from time import time
import gc import gc
from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG from zLOG import LOG
from Products.CMFCore.tests.base.testcase import LogInterceptor from Products.CMFCore.tests.base.testcase import LogInterceptor
...@@ -39,6 +40,8 @@ from Products.CMFCore.tests.base.testcase import LogInterceptor ...@@ -39,6 +40,8 @@ from Products.CMFCore.tests.base.testcase import LogInterceptor
# (which has 31645.6 pystones/second) # (which has 31645.6 pystones/second)
MIN_OBJECT_VIEW=0.112 MIN_OBJECT_VIEW=0.112
MAX_OBJECT_VIEW=0.122 MAX_OBJECT_VIEW=0.122
MIN_OBJECT_PROXYFIELD_VIEW=0.112
MAX_OBJECT_PROXYFIELD_VIEW=0.122
CURRENT_MIN_OBJECT_VIEW=0.1220 CURRENT_MIN_OBJECT_VIEW=0.1220
CURRENT_MAX_OBJECT_VIEW=0.1280 CURRENT_MAX_OBJECT_VIEW=0.1280
MIN_MODULE_VIEW=0.125 MIN_MODULE_VIEW=0.125
...@@ -210,6 +213,41 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -210,6 +213,41 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
MIN_TIC, tic_value, MAX_TIC)) MIN_TIC, tic_value, MAX_TIC))
i += 1 i += 1
def test_viewProxyField(self, quiet=quiet):
# render a form with proxy fields: Foo_viewProxyField
foo = self.portal.foo_module.newContent(
portal_type='Foo',
title='Bar Test',
quantity=10000,
price=32,
start_date=DateTime(2008,1,1))
foo.newContent(portal_type='Foo Line',
title='Line 1')
foo.newContent(portal_type='Foo Line',
title='Line 2')
get_transaction().commit()
self.tic()
# Check performance
before_view = time()
for x in xrange(100):
foo.Foo_viewProxyField()
after_view = time()
req_time = (after_view - before_view)/100.
if not quiet:
print "time to view proxyfield form %.4f < %.4f < %.4f\n" % \
( MIN_OBJECT_PROXYFIELD_VIEW,
req_time,
MAX_OBJECT_PROXYFIELD_VIEW )
if DO_TEST:
self.failUnless( MIN_OBJECT_PROXYFIELD_VIEW < req_time
< MAX_OBJECT_PROXYFIELD_VIEW,
'%.4f < %.4f < %.4f' % (
MIN_OBJECT_PROXYFIELD_VIEW,
req_time,
MAX_OBJECT_PROXYFIELD_VIEW))
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPerformance)) suite.addTest(unittest.makeSuite(TestPerformance))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment