Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
Commits
27acb54e
Commit
27acb54e
authored
Oct 06, 2011
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more test suites & use random sleep
parent
64957011
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
195 additions
and
3 deletions
+195
-3
erp5/util/benchmark/examples/accessSPL.py
erp5/util/benchmark/examples/accessSPL.py
+26
-0
erp5/util/benchmark/examples/createPerson.py
erp5/util/benchmark/examples/createPerson.py
+13
-3
erp5/util/benchmark/examples/createSPL.py
erp5/util/benchmark/examples/createSPL.py
+95
-0
erp5/util/benchmark/examples/createWebPage.py
erp5/util/benchmark/examples/createWebPage.py
+61
-0
No files found.
erp5/util/benchmark/examples/accessSPL.py
0 → 100644
View file @
27acb54e
# -*- coding: utf-8 -*-
def
accessSPL
(
result
,
browser
):
"""
This suite measure access time to a random sale packing list
ERP5 site must contains a script Base_getRandomSPL with the
following code :
module = context.getPortalObject().sale_packing_list_module
total = len(module)
import random
i = random.randint(0, total)
spl = module.searchFolder(limit=(i,1))
return spl.getId()
"""
browser
.
mainForm
.
submitLogin
()
base_url
=
browser
.
url
result
(
'Get ID'
,
browser
.
open
(
browser
.
url
+
'/Base_getRandomSPL'
))
spl_id
=
browser
.
contents
url
=
base_url
+
'/sale_packing_list_module/%s/view'
%
(
spl_id
)
result
(
'Get SPL'
,
browser
.
open
(
url
))
result
(
'Reload SPL'
,
browser
.
open
(
url
))
# Clear cookies so that haproxy distributes suite to another node
browser
.
cookies
.
clearAll
()
erp5/util/benchmark/examples/createPerson.py
View file @
27acb54e
# -*- coding: utf-8 -*-
def
createPerson
(
result
,
browser
):
"""
Create a Person and add a telephone number. It can be ran infinitely (e.g.
...
...
@@ -11,14 +10,17 @@ def createPerson(result, browser):
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 tests requires the bt5 erp5_simulation_performance_test
to be isntalled for relation with organisation
"""
# Log in unless already logged in by a previous test suite
browser
.
mainForm
.
submitLogin
()
browser
.
randomSleep
(
2
,
6
)
# Go to Persons module (person_module)
result
(
'Go to person module'
,
browser
.
mainForm
.
submitSelectModule
(
value
=
'/person_module'
))
browser
.
randomSleep
(
2
,
6
)
# Create a new person and record the time elapsed in seconds
result
(
'Add Person'
,
browser
.
mainForm
.
submitNew
())
...
...
@@ -28,6 +30,9 @@ def createPerson(result, browser):
# 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
.
randomSleep
(
5
,
15
)
# Submit the changes, record the time elapsed in seconds
result
(
'Save'
,
browser
.
mainForm
.
submitSave
())
...
...
@@ -37,6 +42,8 @@ def createPerson(result, browser):
person_url
=
browser
.
url
# Add phone number
browser
.
randomSleep
(
2
,
6
)
result
(
'Add telephone'
,
browser
.
mainForm
.
submitSelectAction
(
value
=
'add Telephone'
))
...
...
@@ -45,6 +52,8 @@ def createPerson(result, browser):
browser
.
mainForm
.
getControl
(
name
=
'field_my_telephone_number'
).
value
=
'0123456789'
# Submit the changes, record the time elapsed in seconds
browser
.
randomSleep
(
3
,
9
)
result
(
'Save'
,
browser
.
mainForm
.
submitSave
())
# Check whether the changes have been successfully updated
...
...
@@ -55,6 +64,7 @@ def createPerson(result, browser):
# Validate it (as the workflow action may not be available yet, try 5 times
# and sleep 5s between each attempts before failing)
browser
.
randomSleep
(
2
,
6
)
show_validate_time
,
waiting_for_validate_action
=
\
browser
.
mainForm
.
submitSelectWorkflow
(
value
=
'validate_action'
,
maximum_attempt_number
=
5
,
...
...
erp5/util/benchmark/examples/createSPL.py
0 → 100644
View file @
27acb54e
# -*- coding: utf-8 -*-
def
createSPL
(
result
,
browser
):
"""
Create a Sale Packing List & go until the stopped state
This tests requires the bt5 erp5_simulation_performance_test
to be installed & configured
"""
# Log in unless already logged in by a previous test suite
browser
.
mainForm
.
submitLogin
()
browser
.
randomSleep
(
2
,
6
)
# Go to SPL module (person_module)
result
(
'Go to spl module'
,
browser
.
mainForm
.
submitSelectModule
(
value
=
'/sale_packing_list_module'
))
browser
.
randomSleep
(
2
,
6
)
# Create a new person and record the time elapsed in seconds
result
(
'Add SPL'
,
browser
.
mainForm
.
submitNew
())
# Check whether it has been successfully created
assert
browser
.
getTransitionMessage
()
==
'Object created.'
# Fill the form
browser
.
mainForm
.
getControl
(
name
=
'field_my_source_section_title'
).
value
=
'Supplier'
browser
.
mainForm
.
getControl
(
name
=
'field_my_source_title'
).
value
=
'Supplier'
browser
.
mainForm
.
getControl
(
name
=
'field_my_source_administration_title'
).
value
=
'Supplier'
browser
.
mainForm
.
getControl
(
name
=
'field_my_price_currency'
).
value
=
[
'currency_module/euro'
]
browser
.
mainForm
.
getControl
(
name
=
'field_my_specialise_title'
).
value
=
'Test Sale Trade Condition'
browser
.
mainForm
.
getControl
(
name
=
'field_my_destination_section_title'
).
value
=
'Client'
browser
.
mainForm
.
getControl
(
name
=
'field_my_destination_title'
).
value
=
"Recipient 1"
browser
.
mainForm
.
getControl
(
name
=
'field_my_destination_administration_title'
).
value
=
"Recipient 2"
browser
.
mainForm
.
getControl
(
name
=
'field_my_comment'
).
value
=
"Benchmark test"
browser
.
randomSleep
(
5
,
15
)
# Submit the changes, record the time elapsed in seconds
result
(
'Save'
,
browser
.
mainForm
.
submitSave
())
# Check whether the changes have been successfully updated
assert
browser
.
getTransitionMessage
()
==
'Data updated.'
spl_url
=
browser
.
url
spl_url
=
'/'
.
join
(
spl_url
.
split
(
'/'
)[:
-
1
])
# Use fast input
result
(
"Open fast input"
,
browser
.
open
(
spl_url
+
'/Delivery_checkConsistencyForDeliveryFastInputDialog'
))
for
i
in
xrange
(
1
,
10
):
browser
.
mainForm
.
getControl
(
name
=
'field_listbox_title_new_%s'
%
(
i
,)).
value
=
'Luxury %s'
%
(
i
,)
browser
.
mainForm
.
getControl
(
name
=
'field_listbox_quantity_new_%s'
%
(
i
,)).
value
=
'%s'
%
(
i
,)
browser
.
randomSleep
(
10
,
30
)
result
(
"Update fast input"
,
browser
.
mainForm
.
submitDialogUpdate
())
browser
.
randomSleep
(
3
,
9
)
result
(
"Save fast input"
,
browser
.
mainForm
.
submitDialogConfirm
())
assert
browser
.
getTransitionMessage
()
==
"Sale Packing List Line Created."
# Go back to the SPL page before validating
browser
.
open
(
spl_url
)
# Confirm it (as the workflow action may not be available yet, try 5 times
# and sleep 5s between each attempts before failing)
browser
.
randomSleep
(
2
,
6
)
show_confirm_time
,
waiting_for_confirm_action
=
\
browser
.
mainForm
.
submitSelectWorkflow
(
value
=
'confirm_action'
,
maximum_attempt_number
=
5
,
sleep_between_attempt
=
5
)
result
(
'Waiting for confirm_action'
,
waiting_for_confirm_action
)
result
(
'Show confirm'
,
show_confirm_time
)
result
(
'Confirmed'
,
browser
.
mainForm
.
submitDialogConfirm
())
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
# Ship it
browser
.
randomSleep
(
2
,
6
)
show_start_time
,
waiting_for_start_action
=
\
browser
.
mainForm
.
submitSelectWorkflow
(
value
=
'start_action'
,
maximum_attempt_number
=
5
,
sleep_between_attempt
=
5
)
result
(
'Waiting for start_action'
,
waiting_for_start_action
)
result
(
'Show start'
,
show_start_time
)
result
(
'Started'
,
browser
.
mainForm
.
submit
(
name
=
'Base_callDialogMethod:method'
))
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
# Receive it
browser
.
randomSleep
(
2
,
6
)
show_stop_time
,
waiting_for_stop_action
=
\
browser
.
mainForm
.
submitSelectWorkflow
(
value
=
'stop_action'
,
maximum_attempt_number
=
5
,
sleep_between_attempt
=
5
)
result
(
'Waiting for stop_action'
,
waiting_for_stop_action
)
result
(
'Show stop'
,
show_stop_time
)
result
(
'Stopped'
,
browser
.
mainForm
.
submit
(
name
=
'Base_callDialogMethod:method'
))
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
erp5/util/benchmark/examples/createWebPage.py
0 → 100644
View file @
27acb54e
# -*- coding: utf-8 -*-
def
createWebPage
(
result
,
browser
):
"""
Create a minimal web page with some content & submit it
Note : you need your user to have Assignor role to do workflow transition
"""
# Log in unless already logged in by a previous test suite
browser
.
mainForm
.
submitLogin
()
browser
.
randomSleep
(
2
,
6
)
# Go to WebPage module (person_module)
result
(
'Go to Web Page module'
,
browser
.
mainForm
.
submitSelectModule
(
value
=
'/web_page_module'
))
browser
.
randomSleep
(
2
,
6
)
# Create a new person and record the time elapsed in seconds
result
(
'Add Web Page'
,
browser
.
mainForm
.
submitNew
())
# Check whether it has been successfully created
assert
browser
.
getTransitionMessage
()
==
'Object created.'
# Fill the form
browser
.
mainForm
.
getControl
(
name
=
'field_my_title'
).
value
=
'Web Page Bench'
browser
.
mainForm
.
getControl
(
name
=
'field_my_short_title'
).
value
=
'test'
browser
.
mainForm
.
getControl
(
name
=
'field_my_reference'
).
value
=
'001'
browser
.
mainForm
.
getControl
(
name
=
'field_my_version'
).
value
=
"001"
browser
.
mainForm
.
getControl
(
name
=
'field_my_language'
).
value
=
'en'
browser
.
mainForm
.
getControl
(
name
=
'field_my_int_index'
).
value
=
'10'
browser
.
mainForm
.
getControl
(
name
=
'field_my_description'
).
value
=
'Benchmark test'
browser
.
randomSleep
(
5
,
15
)
# Submit the changes, record the time elapsed in seconds
result
(
'Save'
,
browser
.
mainForm
.
submitSave
())
# Check whether the changes have been successfully updated
assert
browser
.
getTransitionMessage
()
==
'Data updated.'
WebPage_url
=
browser
.
url
# Edit content
WebPage_url
=
'/'
.
join
(
WebPage_url
.
split
(
'/'
)[:
-
1
])
browser
.
open
(
WebPage_url
+
"/WebPage_viewEditor"
)
browser
.
mainForm
.
getControl
(
name
=
'field_my_text_content'
).
value
=
'<html><body><h1>Test</h1><p>Content if test</p></body></html>'
# Submit the changes, record the time elapsed in seconds
browser
.
randomSleep
(
10
,
30
)
result
(
'Save'
,
browser
.
mainForm
.
submitSave
())
# Check whether the changes have been successfully updated
assert
browser
.
getTransitionMessage
()
==
'Data updated.'
# Publish it
browser
.
randomSleep
(
2
,
6
)
show_publish_time
,
waiting_for_publish_action
=
\
browser
.
mainForm
.
submitSelectWorkflow
(
value
=
'publish_action'
,
maximum_attempt_number
=
5
,
sleep_between_attempt
=
5
)
result
(
'Waiting for publish_action'
,
waiting_for_publish_action
)
result
(
'Show publish'
,
show_publish_time
)
result
(
'Published'
,
browser
.
mainForm
.
submit
(
name
=
'Base_callDialogMethod:method'
))
assert
browser
.
getTransitionMessage
()
==
'Status changed.'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment