Commit 15e143fa authored by Arnaud Fontaine's avatar Arnaud Fontaine

Add an example explaining how to use erp5.utils.benchmark

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@45998 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8ddea869
# -*- coding: utf-8 -*-
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''.
"""
# Go to Persons module (person_module)
result('Go to person module',
browser.mainForm.timeSubmitSelectModuleInSecond(value='/person_module'))
# Create a new person and record the time elapsed in seconds
result('Add Person', browser.mainForm.timeSubmitNewInSecond())
# 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 = 'Foo'
browser.mainForm.getControl(name='field_my_last_name').value = 'Bar'
# Submit the changes, record the time elapsed in seconds
result('Save', browser.mainForm.timeSubmitSaveInSecond())
# Check whether the changes have been successfully updated
assert browser.getTransitionMessage() == 'Data updated.'
# Add phone number
result('Add telephone',
browser.mainForm.timeSubmitSelectActionInSecond(value='add Telephone'))
# 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.timeSubmitSaveInSecond())
# Check whether the changes have been successfully updated
assert browser.getTransitionMessage() == 'Data updated.'
# Specify user login/password used to run the tests
user_tuple = (('zope', 'zope'),)
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