Commit a770d64a authored by Roque Porchetto's avatar Roque Porchetto

New test suite and related files, for scalability tests.

parent 3c2b0818
......@@ -16,7 +16,6 @@ class WendelinERP5(ERP5TypeTestSuite):
for x in [component_re.match(y) for y in glob.glob(os.path.join(
BT5, '*', '*', '*', 'test.erp5.wendelin.test*.py'))]]
class MasterWendelinERP5(ERP5TypeTestSuite):
def getTestList(self):
......@@ -24,4 +23,84 @@ class MasterWendelinERP5(ERP5TypeTestSuite):
"/test\.[^.]+\.[^.]+\.([^.]+).py$")
return ['%s:%s' % (x.group(1), x.group(2)) \
for x in [component_re.match(y) for y in glob.glob(os.path.join(
BT5, '*', '*', '*', 'test.erp5.wendelin.test*.py'))]]
\ No newline at end of file
BT5, '*', '*', '*', 'test.erp5.wendelin.test*.py'))]]
class _ERP5(ERP5TypeTestSuite):
realtime_output = False
enabled_product_list = ('CMFActivity', 'CMFCategory', 'ERP5', 'ERP5Catalog',
'ERP5eGovSecurity', 'ERP5Form',
'ERP5OOo', 'ERP5Security', 'ERP5SyncML', 'ERP5Type',
'ERP5VCS', 'ERP5Wizard', 'Formulator', 'ERP5Workflow',
'ERP5Configurator','HBTreeFolder2', 'MailTemplates',
'PortalTransforms', 'TimerService', 'ZLDAPConnection',
'ZLDAPMethods', 'ZMySQLDA', 'ZSQLCatalog', 'Zelenium')
def enableProducts(self):
product_set = set(self.enabled_product_list)
try:
dir_set = set(os.walk('Products').next()[1])
for product in dir_set - product_set:
os.unlink(os.path.join('Products', product))
product_set -= dir_set
except StopIteration:
os.mkdir('Products')
for product in product_set:
os.symlink(os.path.join('..', 'products', product),
os.path.join('Products', product))
def _getAllTestList(self):
test_list = []
path = sys.path[0]
component_re = re.compile(".*/([^/]+)/TestTemplateItem/portal_components"
"/test\.[^.]+\.([^.]+).py$")
for test_path in (
glob('%s/product/*/tests/test*.py' % path) +
glob('%s/bt5/*/TestTemplateItem/test*.py' % path) +
glob('%s/bt5/*/TestTemplateItem/portal_components/test.*.test*.py' % path)):
component_re_match = component_re.match(test_path)
if component_re_match is not None:
test_case = "%s:%s" % (component_re_match.group(1),
component_re_match.group(2))
else:
test_case = test_path.split(os.sep)[-1][:-3] # remove .py
product = test_path.split(os.sep)[-3]
# don't test 3rd party products
if product in ('PortalTransforms', 'MailTemplates', 'Zelenium'):
continue
# ERP5TioSafe is disabled for now because it requires external programs
# such as php and it has not been updated for Zope >= 2.12
if product == 'ERP5TioSafe':
continue
test_list.append(test_case)
return test_list
def update(self):
self.checkout('products', 'bt5')
self.enableProducts()
class WendelinERP5_scalability(_ERP5):
def getTestList(self):
return ['createPerson']
def getTestPath(self):
return 'examples/'
def getUsersFilePath(self):
return 'examples/scalabilityUsers'
def getUserNumber(self, test_number):
return 1
return [45, 135, 170, 220, 250][test_number]
# Test duration in seconds
def getTestDuration(self, test_number):
return 60*10
def getTestRepetition(self, test_number):
return 1
return 3
# Specify user login/password used to run the tests. Note that there must be
# the same number of users specified here *and* on the script command-line.
# for now, hardcoded credentials for just one user
user_tuple = tuple([('zope', 'yiujrsvp') for x in range(0, 1)])
\ No newline at end of file
# -*- coding: utf-8 -*-
TMIN_SLEEP_SHORT = 2
TMAX_SLEEP_SHORT = 6
TMIN_SLEEP = 5
TMAX_SLEEP = 15
TMIN_SLEEP_LONG = 10
TMAX_SLEEP_LONG = 30
def createPerson(result, browser):
"""
Create a Person and add a telephone number. It can be ran infinitely (e.g.
until it is interrupted by the end user) with 1 concurrent user, through
performance_tester_erp5 with the following command:
performance_tester_erp5 http://foo.bar:4242/erp5/ 1 createPerson
Please note that you must run this command from the same directory of this
script and userInfo.py. Further information about performance_tester_erp5
options and arguments are available by specifying ``--help''.
This test requires the bt5 erp5_simulation_performance_test to be installed
for relation with organisation.
Also, in order to get more realistic results with concurrent users, random
sleep must be introduced to simulate a "real" user. This can be done through
'sleep' parameter (a tuple giving the minimum and maximum sleep time) to
open*() (Browser instance), submit*() (Form instance) and click*() (Link
instance).
"""
# Open ERP5 homepage
browser.open(sleep=(TMIN_SLEEP_SHORT, TMAX_SLEEP_SHORT))
# Log in unless already logged in by a previous test suite
browser.mainForm.submitLogin(sleep=(TMIN_SLEEP_SHORT, TMAX_SLEEP_SHORT))
# Go to Persons module (person_module)
result('Go to person module',
browser.mainForm.submitSelectModule(value='/person_module', #value='/erp5/person_module',
sleep=(TMIN_SLEEP_SHORT, TMAX_SLEEP_SHORT)))
# Create a new person and record the time elapsed in seconds
result('Add Person', browser.mainForm.submitNew())
# Check whether it has been successfully created
assert browser.getTransitionMessage() == 'Object created.'
# Fill the first and last name of the newly created person
browser.mainForm.getControl(name='field_my_first_name').value = 'Create'
browser.mainForm.getControl(name='field_my_last_name').value = 'Person'
# Link to organisation, this will add subobjects
# browser.mainForm.getControl(name='field_my_career_subordination_title').value = 'Supplier'
#browser.open("http://10.0.53.106:2200/erp5/person_module/9?portal_status_message=Object%20created.")#&editable_mode:int=1")
#browser.open("http://10.0.53.106:2200/erp5/person_module/9?portal_status_message=Data%20updated.")
# Submit the changes, record the time elapsed in seconds
result('Save', browser.mainForm.submitSave(sleep=(TMIN_SLEEP, TMAX_SLEEP)))
# Check whether the changes have been successfully updated
assert browser.getTransitionMessage() == 'Data updated.'
person_url = browser.url
# Add phone number
result('Add telephone',
browser.mainForm.submitSelectAction(value='add Telephone',
sleep=(TMIN_SLEEP_SHORT, TMAX_SLEEP_SHORT)))
# Fill telephone title and number
browser.mainForm.getControl(name='field_my_title').value = 'Personal'
browser.mainForm.getControl(name='field_my_telephone_number').value = '0123456789'
# Submit the changes, record the time elapsed in seconds
result('Save', browser.mainForm.submitSave(sleep=(TMIN_SLEEP_SHORT, TMAX_SLEEP_SHORT)))
# Check whether the changes have been successfully updated
assert browser.getTransitionMessage() == 'Data updated.'
# Go back to the Person page before validating
browser.open(person_url)
# Validate it (as the workflow action may not be available yet, try 5 times
# and sleep 5s between each attempts before failing)
show_validate_time, waiting_for_validate_action = \
browser.mainForm.submitSelectWorkflow(value='validate_action',
maximum_attempt_number=5,
sleep_between_attempt=5,
sleep=(TMIN_SLEEP_SHORT, TMAX_SLEEP_SHORT))
result('Waiting for validate_action', waiting_for_validate_action)
result('Show validate', show_validate_time)
result('Validated', browser.mainForm.submitDialogConfirm())
assert browser.getTransitionMessage() == 'Status changed.'
\ No newline at end of file
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